#abc212g. G - Power Pair
G - Power Pair
Score : points
问题描述
已知一个质数 。
有多少对整数 满足以下条件?
- 存在一个正整数 ,使得 。
由于答案可能非常大,请将结果模 后输出。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
Given is a prime number .
How many pairs of integers satisfy the following conditions?
- There exists a positive integer such that .
Since the answer may be enormous, print it modulo .
Constraints
- is a prime number.
Input
Input is given from Standard Input in the following format:
Output
Print the answer modulo .
Sample Input 1
3
Sample Output 1
4
Four pairs satisfy the conditions.
Sample Input 2
11
Sample Output 2
64
Sample Input 3
998244353
Sample Output 3
329133417
update @ 2024/3/10 09:28:22