问题 K: Three Operations

内存限制:512 MB 时间限制:3 S
题面:传统 评测方式:文本比较 上传者:
提交:2 通过:1

题目描述

Given three integers x, a, b. You can do the following three operations several times:


Calculate the smallest number of operations to set xx to 00.

输入格式

The input consists of multiple test cases. The first line contains a single integer T (1T2×104) - the number of test cases. Description of the test cases follows.

The first line of each test case contains three integers x, a, b(0x,a,b1018).

 

输出格式

For each test case, print one integer - the smallest number of operations to set x to 0.

输入样例 复制

5
1 1 4
5 1 4
19 1 9
8 1 0
1145141919810 114514 1919810

输出样例 复制

1
4
5
3
1389

分类标签