#P1890. gcd 区间
gcd 区间
Description
Given positive integers .
There are queries. For each query, given an interval , output the greatest common divisor of .
Input Format
The first line contains two integers .
The second line contains integers representing .
Each of the next lines contains two integers representing the left and right endpoints of the query interval.
Output Format
Print lines, each line is the answer to one query.
5 3
4 12 3 6 7
1 3
2 3
5 5
1
3
7
Hint
- For of the testdata, , .
- For of the testdata, .
- For of the testdata, , , .
Translated by ChatGPT 5
京公网安备 11011102002149号