#P4464. [国家集训队] JZPKIL
[国家集训队] JZPKIL
Description
Given , compute
$$\sum_{i=1}^{n}\mathrm{gcd}(i,n)^x \mathrm{lcm}(i,n)^y \bmod (10^9+7)$$.
Input Format
The first line contains the number of queries . Each of the next lines contains three integers .
Output Format
Output lines, each containing one integer, the answer to the corresponding query.
5
6 0 0
6 0 1
6 1 0
6 1 1
1000000000 50 50
6
66
15
126
393442025
Hint
Constraints: For 30% of the testdata, . For another 30% of the testdata, , . For 100% of the testdata, , , .
Source: 2012 CTT mutual testing, by gyz.
Translated by ChatGPT 5
京公网安备 11011102002149号