Richie Rich Codechef Solution

Richie Rich Solution Problem Code: CHFRICH

Chef aims to be the richest person in Chefland by his new restaurant franchise. Currently, his assets are worth AA billion dollars and have no liabilities. He aims to increase his assets by XX billion dollars per year.

Also, all the richest people in Chefland are not planning to grow and maintain their current worth.

To be the richest person in Chefland, he needs to be worth at least BB billion dollars. How many years will it take Chef to reach his goal if his value increases by XX billion dollars each year?

Input

  • The first line contains an integer TT, the number of test cases. Then the test cases follow.
  • Each test case contains a single line of input, three integers AA, BB, XX.

Output

For each test case, output in a single line the answer to the problem.

Constraints

  • 1≤T≤21 0001≤T≤21 000
  • 100≤A<B≤200100≤A<B≤200
  • 1≤X≤501≤X≤50
  • XX divides B−AB−A

Subtasks

Subtask #1 (100 points): Original constraints

Sample Input

3
100 200 10
111 199 11
190 200 10

Sample Output

10
8
1

Explanation

Test Case 11: Chef needs to increase his worth by 200−100=100200−100=100 billion dollars and his increment per year being 1010 billion dollars, so it will take him 10010=1010010=10 years to do so.

Test Case 22: Chef needs to increase his worth by 199−111=88199−111=88 billion dollars and his increment per year being 1111 billion dollars, so it will take him 8811=88811=8 years to do so.

Test Case 33: Chef needs to increase his worth by 200−190=10200−190=10 billion dollars and his increment per year being 1010 billion dollars, so it will take him 1010=11010=1 year to do so.

Program:

for _ in range(int(input())):
   x,y,z =map(int, input().split())
   print(int((y-x)/z))

Weekly Contest 247

Biweekly Contest 55

June Long Challenge 2021 Solutions

March Long Challenge 2021 Solutions

April Long Challenge 2021 Solutions

Codechef Long Challenge Solutions

February Long Challenge 2021

January Long Challenge 2021

November Challenge 2020 SOLUTION CodeChef

October Lunchtime 2020 CodeChef SOLUTIONS

Related :

Related :

Leave a Comment