The Mango Truck CodeChef Solution | CodeChef Problem Solution 2022
You are given that a mango weighs kilograms and a truck weighs kilograms. You want to cross a bridge that can withstand a weight of kilograms.
Find the maximum number of mangoes you can load in the truck so that you can cross the bridge safely.
Input Format
- First line will contain , the number of test cases. Then the test cases follow.
- Each test case consists of a single line of input, three integers - the weight of mango, the weight of truck and the weight the bridge can withstand respectively.
Output Format
For each test case, output in a single line the maximum number of mangoes that you can load in the truck.
Constraints
Sample Input 1
4
2 5 11
4 10 20
1 1 1
6 40 90
Sample Output 1
3
2
0
8
Explanation
Test case : You can load mangoes at maximum. The total weight is . Thus, the truck can safely cross the bridge with mangoes. If you load mangoes, the total weight is .
Test case : You can load mangoes at maximum. The total weight is . Thus, the truck can safely cross the bridge with mangoes.
Test case : You can load mangoes at maximum. The total weight is . Thus, the truck can safely cross the bridge only if there are mangoes.
Test case : You can load mangoes at maximum. The total weight is . Thus, the truck can safely cross the bridge with mangoes.
Join Now for Solution:-
No comments:
Post a Comment