摘要: ACM模板 用于简化模运算的定理 欧拉定理 a与m互质,a^phi(m)%m==1-->m为质数 a^(m-1)%m==1 威尔逊定理 p为素数 (p-1)!%p==p-1 1 费马定理 p为素数,a和p互质,a^(p-1)%p==1 费马小定理 p为素数,a^p%p==a-->(a^p/a)%p= 阅读全文
posted @ 2017-05-08 23:21 cdongyang 阅读(289) 评论(0) 推荐(0) 编辑
摘要: Given 5 integers: a, b, c, d, k, you're to find x in a...b, y in c...d that GCD(x, y) = k. GCD(x, y) means the greatest common divisor of x and y. Sin 阅读全文
posted @ 2017-05-08 22:13 cdongyang 阅读(209) 评论(0) 推荐(0) 编辑
摘要: 1 #include <bits/stdc++.h> 2 using namespace std; 3 typedef long long LL; 4 const int N=1e6+10; 5 const int INF=0x3f3f3f3f; 6 int cas=1,T; 7 int c[N]; 阅读全文
posted @ 2017-05-08 22:09 cdongyang 阅读(187) 评论(0) 推荐(0) 编辑
摘要: 1 #include <bits/stdc++.h> 2 using namespace std; 3 typedef long long LL; 4 void gcd(LL a, LL b, LL &d, LL &x, LL &y) 5 { 6 if (!b) 7 { 8 d = a; 9 x = 阅读全文
posted @ 2017-05-08 19:57 cdongyang 阅读(217) 评论(0) 推荐(0) 编辑
摘要: 1 #include <bits/stdc++.h> 2 using namespace std; 3 int p,x,y,a[26]; 4 bool init(int s) 5 { 6 int i=s/50%475; 7 for (int j=0;j<25;j++) 8 { 9 i=(i*96+4 阅读全文
posted @ 2017-05-08 14:51 cdongyang 阅读(312) 评论(0) 推荐(0) 编辑