Ishika got stuck on an island. There is only one shop on this island and it is open on all days of the week except for Sunday. Consider following constraints:
Currently, it’s Monday, and she needs to survive for the next S days.
Find the minimum number of days on which you need to buy food from the shop so that she can survive the next S days, or determine that it isn’t possible to survive.
The first line of the input an integer T, the number of test cases. For each test case, there are three integers s, n, m denoting the number of days she is required to survive, the maximum unit of food that she can buy each day and unit of food that is required each day to survive respectively.
For each test case, the output is an integer displaying the minimum number of days she needs to buy food and if she can't survive return -1.
10 16 2
10 20 30
1. One possible solution is to buy a box on the first day (Monday), it’s sufficient to eat from this box up to 8th day (Monday) inclusive. Now, on the 9th day (Tuesday), you buy another box and use the chocolates in it to survive the 9th and 10th day.
2. She can’t survive even if she buy food because the maximum number of units she can buy in one day is less the required food for one day.
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.