# Richie Rich Codechef Solution

Richie Rich Codechef Solution: 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

Subtask #1 (100 points): Original constraints

```3
100 200 10
111 199 11
190 200 10
```

```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.

### Richie Rich CodeChef Solution in JAVA

```import java.io.*;
import java.util.*;
public class Main
{
public static void main(String[] args) throws IOException
{
try{
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
for(int i=0;i<t;i++){
int A = sc.nextInt();
int B = sc.nextInt();
int X = sc.nextInt();
int need_to_increase = B - A;
int years = need_to_increase / X;
System.out.println(years);
}
}catch(Exception e){
return;
}
}
}
```

### Richie Rich CodeChef Solution in CPP

```#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
for(int i=0;i<t;i++)
{
int a,b,x;
cin>>a>>b>>x;
int z=(b-a)/x;
cout<<z<<endl;
}
return 0;
}```

### Richie Rich CodeChef Solution in Python

```t=int(input())
for i in range(t):
a,b,c=map(int,input().split())
print((b-a)//c)```

Disclaimer: The above Problem (Richie Rich) is generated by CodeChef but the solution is provided by Chase2learn.This tutorial is only for Educational and Learning purpose.

Sharing Is Caring