Problem A
Add Two Game
For this problem you have two boxes that can hold a number of small stones. At the start there are some stones in each box. You can add more stones from the beach to either box, but it must be the same number as are currently in the other box. The challenge is in determining how many times you need to add stones to the boxes in order to have at least $T$ stones in one of them.
Example: box 1 has 1 stone, box 2 has 2 stones, and the target is to have at least $T=10$ stones in one of the boxes. So, this one can be done in 4 steps. Note that if you pick differently, it may have taken more steps. (An example of this: It would have taken 5 steps if we only added stones to box 1.)
|
Step |
Box 1 |
Box 2 |
Explanation |
|
0 |
1 |
2 |
Starting Configuration |
|
1 |
3 |
2 |
Add stones to Box 1 (same as the 2 in Box 2) |
|
2 |
5 |
2 |
Add stones to Box 1 (same as the 2 in Box 2) |
|
3 |
5 |
7 |
Add stones to Box 2 (same as the 5 in Box 1) |
|
4 |
12 |
7 |
Box 1 has reached the target of 10 stones |
Input
You will be given the initial number of stones in box 1 on the first line, and the initial number of stones in box 2 on the second line. The third line will contain the minimum target number of stones $T$ for at least one of the boxes. Each of these numbers will be integers, at least 1, and will be less than $2^{16}$ (65536).
Output
Print a single integer, the minimum number of steps that are needed to have the number of stones in at least one of the boxes reach the target number of stones $T$.
| Sample Input 1 | Sample Output 1 |
|---|---|
1 2 10 |
4 |
| Sample Input 2 | Sample Output 2 |
|---|---|
10 15 100 |
4 |
