【51Nod】1014 X^2 Mod P
2017-05-23 19:19
281 查看
题意
X*X mod P = A,其中P为质数。给出P和A,求<=P的所有X。解题思路
从0~P枚举X,把满足条件的X输出。参考代码
#include <iostream> using namespace std; typedef long long ll; int main(){ ll p,a; while (cin>>p>>a){ int cnt=0; for (ll i=2;i<=p;i++){ if (i*i%p==a){ if (cnt==0) cout<<i; else cout<<" "<<i; cnt++; } } if (cnt==0) cout<<"No Solution"; cout<<endl; } return 0; }
相关文章推荐
- 51nod 1014 X^2 Mod P
- 51nod 1014 X^2 Mod P
- 51Nod 1014 X^2 Mod P
- 51nod 1014 X^2 Mod P
- 51Nod-1014 X^2 Mod P【暴力】
- 51nod-1014 X^2 Mod P(二次剩余。。求解决)
- 51Nod 1014 X^2 Mod P
- 51Nod--1014 X^2 Mod P
- 51nod 1014 X^2 Mod P
- 51Nod 1014 X^2 Mod P
- 51nod 1014 X^2 Mod P 预处理瞎搞
- 51nod-【1014 X^2 Mod P】
- 51nod 1126 求循环节 注意mod与%区别
- 【51Nod-1008】N的阶乘 mod P
- 1014 X^2 Mod P(数论 枚举)(2级算法题)
- 51Nod--1008 N的阶乘 mod P
- 51nod 1014 X^2 Mod P
- 51nod 1014 X^2 Mod P【暴力】
- 【51Nod】1008 N的阶乘 mod P
- 51nod 1046 A^B Mod C (快速幂)