[GESP202503 五级] 原根判断
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
题目描述
小 A 知道,对于质数 而言, 的原根 是满足以下条件的正整数:
- ;
- ;
- 对于任意 均有 。
其中 表示 除以 的余数。
小 A 现在有一个整数 ,请你帮他判断 是不是 的原根。
输入格式
第一行,一个正整数 ,表示测试数据组数。
每组测试数据包含一行,两个正整数 。
输出格式
对于每组测试数据,输出一行,如果 是 的原根则输出 Yes,否则输出 No。
3
3 998244353
5 998244353
7 998244353
Yes
Yes
No
说明/提示
数据范围
对于 的测试点,保证 。
对于所有测试点,保证 ,,, 为质数。
仲盛周六 13:00 班级 day25_4_11
- Status
- Done
- Rule
- OI
- Problem
- 6
- Start at
- 2025-4-11 18:30
- End at
- 1970-1-1 8:00
- Duration
- -484546.5 hour(s)
- Host
- Partic.
- 23