#CF1103C. Omsk Programmers 鄂木斯克程序员
Omsk Programmers 鄂木斯克程序员
当前没有测试数据。
CF测试跳转:https://codeforces.com/contest/2236/problem/C
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.
Samples
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