#P8443. gcd.
gcd.
Background
I borrow a spark from you, and use it to write about mountains and rivers.
Problem Description
There are test cases. For each test case, you are given . Find the value of $\gcd(\lfloor \frac{l}{x}\rfloor,\lfloor \frac{l+1}{x}\rfloor,\cdots,\lfloor \frac{r}{x}\rfloor)$.
- Here means the greatest common divisor. For example, , , . In particular, we define that the greatest common divisor of a positive integer is itself.
- means rounding down. For example, .
Input Format
The first line contains a positive integer , indicating the number of test cases.
For each test case, one line contains three positive integers , separated by spaces.
Output Format
For each test case, output one line with a positive integer representing the answer.
4
3 6 1
8 11 4
4 4 3
7 16 2
1
2
1
1
Hint
Sample Explanation and Notes
In the sample, , which means there are test cases.
- For the first test case, , so we compute $\gcd(\lfloor \frac{3}{1}\rfloor,\lfloor \frac{4}{1} \rfloor, \lfloor \frac{5}{1}\rfloor,\lfloor \frac{6}{1}\rfloor)=1$.
- For the second test case, , so we compute $\gcd(\lfloor \frac{8}{4} \rfloor,\lfloor \frac{9}{4} \rfloor,\lfloor \frac{10}{4}\rfloor,\lfloor \frac{11}{4}\rfloor)=\gcd(2,2,2,2)=2$.
- For the third test case, , so we compute .
- For the fourth test case, similarly, the result is .
Constraints
- For of the data, .
- For another of the data, .
- For another of the data, .
- For the first of the data above, .
- For all data, , .
Translated by ChatGPT 5