#CF2236C. 鄂木斯克程序员 / C. Omsk Programmers
鄂木斯克程序员 / C. Omsk Programmers
C. Omsk Programmers
Source: Codeforces 2236C
Contest: Codeforces Round 1103 (Div. 3)
Time limit: 1 second
Memory limit: 256 megabytes
Statement
An annual programmers fair is taking place on the main square of Omsk. You, as the main programmer of Omsk, decided to take part in this wonderful event and went there. At the entrance, a guard decided to check your skills and gave you a problem:
You are given three integers , , . You want to make and equal. In order to do so, you can apply the following operations:
- Choose one of the integers or and add to it.
- Choose one of the integers or and divide it by with rounding down.
You need to find the minimum number of operations after which becomes equal to . Can you prove your skills, or will you have to go back home?
Input
The first line contains a single integer — the number of test cases.
Then test cases follow.
Each test case consists of a single line containing three integers , , (, ).
Output
For each test case, output a single integer — the minimum number of operations required to make and equal.
Examples
7
1 2 3
2 3 2
7 3 10
17 3 3
10 10 2
4 7 2
1 6 2
1
1
2
3
0
2
2