#P4896. CGCDSSQ
CGCDSSQ
CGCDSSQ
题面翻译
给出一个长度为 的序列和 个询问,每个询问输出一行,询问 的 的对数.
感谢@凌幽 提供的翻译
题目描述
Given a sequence of integers and queries on it. For each query you have to count the number of pairs such that and .
is a greatest common divisor of , that is equal to a largest positive integer that divides all .
输入格式
Given a sequence of integers and queries on it. For each query you have to count the number of pairs such that and .
is a greatest common divisor of , that is equal to a largest positive integer that divides all .
输出格式
For each query print the result in a separate line.
样例 #1
样例输入 #1
3
2 6 3
5
1
2
3
4
6
样例输出 #1
1
2
2
0
1
样例 #2
样例输入 #2
7
10 20 3 15 1000 60 16
10
1
2
3
4
5
6
10
20
60
1000
样例输出 #2
14
0
2
2
2
0
2
2
1
1