CHOCLATE - CHOCOLATES

CHOCOLATES

 

A shopkeeper sells 1 chocolate at Rs. A each. You can exchange B wrappers for 1 chocolate. If you have N Rs. how many maximum chocolates can you get?

 

Input Specification:

The first line consists of an integer t, the number of test cases. Then for the next t lines, each test case consists of 3 integers A, B and N as defined above.

 

Output Specification:

For each test case find the maximum number of chocolates that you can get.

 

Input Constraints:

1<=t<=1000

1<=A<=20

2<=B<=11

0<=N<=1000000


Sample Input:

5
1 2 0
1 2 5
7 10 7
2 11 4
1 10 4

 

Sample Output:

0
9
1
2
4

 


Added by:cegprakash
Date:2012-05-14
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: BF

© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.