AlgoUniversity
  • Go Back
Discussion
Car Race :

Author

Akshay Sharma

Difficulty Level : Easy

Submissions : 596

Asked In : TCS

Marks :100

: 2 | : 3

In a premier championship series of sports car racing, initially, the 1st car is ahead of the 2nd car by X metres. After that, every second, the 1st car moves ahead by n1 metres and the 2nd can move ahead by n2 metres (in the same direction).

The task is to print the number of seconds after which the 2nd car crosses the 1st car. If it is impossible to do so, then print -1

Input

The first line of the test case contains 3 integers separated by space n1,n2 and X. ($$$1 \le n1 \le n2 \le 10^5 $$$),($$$ 0 \le x \le 1000$$$) . where n1 and n2 are the distance travelled by car1 and car2 in one second and X is the distance by which car1 is ahead of car2

Output

For each test case print, the time taken by car2 to overtake car1 or print -1 is car2 never able to move ahead of car1.

Examples

Input
3 4 1
Output
2
Input
5 4 1
Output
-1
Input
2 12 15
Output
2

Note

Taking 1st test case as an example :

Initially, the 1st car is ahead by 1 metre.

After the 1st second, the 1st and 2nd cars are at the same place.

After the 2nd second, the 2 car moves ahead of the 1st car by 1 metre.

You need to login to view your submissions.

You need to login to view all submissions.

Loading...

Result : Executed

Loading...

Feel something is wrong with the test cases?

Result : Accepted

Test Cases :

You need to Log In
We're glad that you want to attempt this problem!

But to Run or Submit the Problem, you need to Log In.

Continue to Log In
Challenge Submitted!

Your challenge has been submitted successfully.

You will get a response soon via WhatsApp or Email.

Challenge
Facing issue while trying to solve the problem! Don't worry, we got you covered!

Do let us know your issue.

Looks good!
Please enter your issue / feedback.

How do we get in touch with you?
Looks good!
Please enter your phone no.
Looks good!
Please enter your email address.