Mr. Snake

DarkknightRHZ Replay of Intra LU Indivi...
Limits 500ms, 512 MB

Mr Snake has a strange growing ability. Suppose, his length is X units. If he eats X magic fruits, then his body length increases by Y units so that his new total body length becomes (X+Y) units.
Mr Snake is teased by his friends because of his short length. So, he wants to become Z units long. However, he can not figure out how many magic fruits he needs to eat.
Can you help Him?

Note: Z will be given such that (Z-X) is divisible by Y and X< Z.

Input

First line of input will contain a single integer T denoting the number of test cases. Then T lines follow, each containing three integers X, Y and Z .
( 1<= T, X <= 100000, 1 <= Y <= 1000, 1 <= Z <= 1000000)

Output

In a single line, print the number of magic fruits required to be eaten by Mr Snake to grow to Z units in length.

Sample

InputOutput
5
2 2 6
2 2 4
3 2 5
3 2 9
10 2 16
6
2
3
15
36

Submit

Login to submit.

Statistics

84% Solution Ratio
dip_BRUREarliest, Feb '18
bond00Fastest, 0.1s
ehsan_sShuvoLightest, 1.2 MB
murad928Shortest, 104B
Toph uses cookies. By continuing you agree to our Cookie Policy.