You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/* Chef aims to be the richest person in Chefland by his new restaurant franchise. Currently, his assets are worth A billion dollars and have no liabilities. He aims to increase his assets by X billion dollars per year.
2
+
3
+
Also, all the richest people in Chefland are not planning to grow and maintain their current worth.
4
+
5
+
To be the richest person in Chefland, he needs to be worth at least B billion dollars. How many years will it take Chef to reach his goal if his value increases by X billion dollars each year?
6
+
7
+
Input
8
+
The first line contains an integer T, the number of test cases. Then the test cases follow.
9
+
Each test case contains a single line of input, three integers A, B, X.
10
+
Output
11
+
For each test case, output in a single line the answer to the problem.
12
+
13
+
Constraints
14
+
1≤T≤21 000
15
+
100≤A<B≤200
16
+
1≤X≤50
17
+
X divides B−A
18
+
19
+
Sample Input
20
+
3
21
+
100 200 10
22
+
111 199 11
23
+
190 200 10
24
+
Sample Output
25
+
10
26
+
8
27
+
1
28
+
Explanation
29
+
Test Case 1: Chef needs to increase his worth by 200−100=100 billion dollars and his increment per year being 10 billion dollars, so it will take him 10010=10 years to do so.
30
+
31
+
Test Case 2: Chef needs to increase his worth by 199−111=88 billion dollars and his increment per year being 11 billion dollars, so it will take him 8811=8 years to do so.
32
+
33
+
Test Case 3: Chef needs to increase his worth by 200−190=10 billion dollars and his increment per year being 10 billion dollars, so it will take him 1010=1 year to do so. */
0 commit comments