
ZOJ Problem Set  3918
You are given a sequence {A_{0}, A_{1}, ..., A_{N1}}. Defined a function called G(L, R) on A, where G(L, R) = GCD(A_{i}) (L ≤ i < R) that is the greatest common divisor of all the integers in the subsequence. Now there're two kinds of question for you:
InputThere are multiple test cases. Each case begin with a line contains two integers N and Q (1 ≤ N, Q ≤ 10000). The next line contains N integers, A_{0}, A_{1}, ..., A_{N1} (1 ≤ A_{i} ≤ 100). The next Q lines each contains one of two kinds of question mentioned above. OutputFor each C question output an integer in a separate line. Sample Input2 3 4 6 C 0 2 C 0 1 C 1 2 Sample Output3 1 1 HintHuge input and output, scanf and printf is recommended. Author: LIN, Xi Source: ZOJ Monthly, February 2016 