Buying Torches SOLUTION
You are playing an extremely famous game called Cubecraft. At first, you have one stick and need to create k lights. One light can be created utilizing one stick and one coal.
Ideally, you’ve met an exceptionally attractive meandering merchant who has two exchange offers:
trade 1 stick for x sticks (you lose 1 stick and addition x sticks).
trade y sticks for 1 coal (you lose y sticks and addition 1 coal).
During one exchange, you can utilize just one of these two exchange offers. You can utilize each exchange offer quite a few times you need to, in any request.
Your assignment is to locate the base number of exchanges you have to create in any event k lights. The appropriate response consistently exists under the given imperatives.
You need to answer t free experiments.
The principal line of the information contains one whole number t (1≤t≤2⋅104) — the quantity of experiments. At that point t experiments follow.
The main line of the experiment contains three numbers x, y and k (2≤x≤109; 1≤y,k≤109) — the quantity of sticks you can purchase with one stick, the quantity of sticks needed to get one coal and the quantity of lights you need, individually.
For each experiment, print the appropriate response: the base number of exchanges you have to create precisely k lights. The appropriate response consistently exists under the given requirements.
2 1 5
42 13 24
12 11 12
We are Live Join Us
Check Your Mails