Problem B. GCD Array
时间限制 5500 ms
内存限制 64 MB
Teacher Mai finds that many problems about arithmetic function can be reduced to the following problem:
Maintain an array a with index from 1 to l. There are two kinds of operations:
1. Add v to a
x for every x that gcd(x,n)=d.
2. Query
输入数据
输出数据
For each case, output "Case #k:" first, where k is the case number counting from 1.
Then output the answer to each query.
样例输入
复制
6 4
1 4 1 2
2 5
1 3 3 3
2 3
0 0
样例输出
$ Mathjax font initiator $