luogu#P5190. [COCI 2009/2010 #5] PROGRAM
[COCI 2009/2010 #5] PROGRAM
Problem Description
Translated from COCI 2010.03.06 T5 “PROGRAM”.
At the beginning, the array is all zeros. Note that the first element of has index 0, not 1.
void something (int jump) {
for (int i = 0; i < N; i += jump)
++seq[i];
}
Mirko called the function exactly times. In the -th call, .
Then there are queries. Each query contains two integers . For each query, output .
Input Format
The first line contains .
The next line contains integers, where the -th one is .
Line contains .
The next lines each contain two integers .
Output Format
Output lines. The -th line contains the answer to the -th query.
10 4
1 1 2 1
3
0 9
2 6
7 7
35
18
3
11 3
3 7 10
3
0 10
2 6
7 7
8
2
1
1000000 6
12 3 21 436 2 19
2
12 16124
692 29021
16422
28874
Hint
Sample Explanation 1
Sample Explanation 2
Constraints
.
Translated by ChatGPT 5