#P5366. [SNOI2017] 遗失的答案
[SNOI2017] 遗失的答案
Description
After calculating the answer, Little Ball bought a bunch of skins. He was very happy, but by accident, he forgot which skins he had bought. = =|||
Fortunately, he still remembers that he numbered all skins from . Among the skins he bought (he bought at least one skin), the greatest common divisor is , and the least common multiple is .
Now there are queries. Each query gives a number . Please tell Little Ball: among all valid purchase plans, how many of them include skin ?
Because the answer is too large, you only need to output the answer .
Input Format
The first line contains three integers , as described.
The second line contains one integer , the number of queries.
The third line contains integers, each being the asked in a query.
Output Format
For each query, output one integer per line, representing the answer to this query.
5 1 30
5
1 2 3 4 5
1
2
2
0
2
Hint
of the testdata: .
of the testdata: .
of the testdata: .
of the testdata: $\text{N, G, L} \le 10^8, \text{Q} \le 10^5, 1 \le \text{X} \le 10^8$.
Translated by ChatGPT 5
京公网安备 11011102002149号