#P7504. 「HMOI R1」可爱的德丽莎
「HMOI R1」可爱的德丽莎
Description
Cute Theresa hopes you can help her compute the value of
$$\sum_{x = 1}^n\sum_{y = 1}^n\sum_{i = 1}^x[x \bot k_1][i \bot x]\cdot i\cdot \sum_{j = 1}^y[y \bot k_2][j \bot y]\cdot j$$where
$$[x \bot y] = \begin{cases}1 & \operatorname{gcd}(x,y)=1 \\ 0 & \operatorname{gcd}(x,y)\neq 1\end{cases}$$Theresa is so cute, how could you say no to her?
Since the answer may be very large, Theresa only wants to know the result modulo .
Input Format
A single line with three integers .
Output Format
A single line with one number: the required answer modulo .
2 2 2
1
4 2 2
16
Hint
The test point numbering is in reverse order.
Constraints for all data:
- .
This problem uses bundled tests.
| No. | Constraints | Score |
|---|---|---|
| No further constraints |
- Idea: Polaris_Dane
- Solution: Polaris_Dane
- Code: Polaris_Dane
- Data: Polaris_Dane
Translated by ChatGPT 5
京公网安备 11011102002149号