#P2150. [NOI2015] 寿司晚宴
[NOI2015] 寿司晚宴
Description
To celebrate the successful opening of NOI, the organizers prepared a sushi dinner. Xiao G and Xiao W, as NOI contestants, were invited to attend.
At the dinner, the organizers provided different types of sushi, numbered , where the tastiness of the -th type is (that is, tastiness values range from to ).
Now Xiao G and Xiao W each want to choose some types of sushi to taste. A tasting plan is called discordant if and only if: there exists a sushi with tastiness chosen by Xiao G and a sushi with tastiness chosen by Xiao W such that and are not coprime.
They want to count how many harmonious tasting plans there are (i.e., plans that are not discordant), modulo a given positive integer . Note that a person may choose no sushi.
Input Format
The first line contains two positive integers separated by a single space. There are types of sushi in total, with tastiness values from to , and the final answer should be taken modulo .
Output Format
Output a single integer, which is the number of harmonious plans modulo .
3 10000
9
4 10000
21
100 100000000
3107203
Hint
[Constraints]
| Test point ID | Range of | Convention |
|---|---|---|
| 1 | ||
| 2 | Same as above. | Same as above. |
| 3 | ||
| 4 | ||
| 5 | Same as above. | |
| 6 | ||
| 7 | Same as above. | |
| 8 | ||
| 9 | Same as above. | |
| 10 |
Translated by ChatGPT 5
京公网安备 11011102002149号