#P9874. K. Three Operations
K. Three Operations
K. Three Operations
Problem Description
Given three integers . You can do the following three operations several times:
- set to ;
- set to ;
- set to . Calculate the smallest number of operations to set to .
Input
The input consists of multiple test cases. The first line contains a single integer () - the number of test cases. Description of the test cases follows. The first line of each test case contains three integers ().
Output
For each test case, print one integer - the smallest number of operations to set to .
Sample Input
5
1 1 4
5 1 4
19 1 9
8 1 0
1145141919810 114514 1919810
Sample Output
1
4
5
3
1389
Source
2023“钉耙编程”中国大学生算法设计超级联赛(7)