
数论:Polya
文章平均质量分 61
BRCOCOLI
初学者 记录成长 Fighting
展开
-
POJ 1286 Necklace of Beads Polya .
题目地址:http://poj.org/problem?id=1286旋转+翻转,裸的算法#include#include#includeusing namespace std;typedef long long LL;int gcd(int a,int b){ if(b==0) return a; return gcd(b,a%b);}int euler_phi(in原创 2016-08-15 14:01:34 · 260 阅读 · 0 评论 -
POJ 2409 Let it Bead (Polya) .
题目地址:http://poj.org/problem?id=2409旋转+翻转裸的Polya#include#include#includeusing namespace std;typedef long long LL;int gcd(int a,int b){ if(b==0) return a; return gcd(b,a%b);}int euler_ph原创 2016-08-15 17:05:20 · 283 阅读 · 0 评论 -
POJ 2154 Color Polya定理+欧拉函数优化 -
题目地址:http://poj.org/problem?id=2154一直WA,然后发现[m^n%p]/2与m^(n-1)%p不一样...#include#include#includeusing namespace std;typedef long long LL;int N,P;int euler_phi(int n){ int res=1; for(int i=2;原创 2016-08-15 18:23:43 · 467 阅读 · 0 评论 -
HDOJ 3923 Invoker (Polya+乘法逆元)
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=3923因为要取模,所以要乘法逆元#include#include#includeusing namespace std;typedef long long LL;const int P=1000000007;int gcd(int a,int b){ if(b==0) retur原创 2016-08-15 19:45:31 · 345 阅读 · 0 评论 -
Polya定理模板
暴力版#include#include#includeusing namespace std;typedef long long LL;int gcd(int a,int b){ if(b==0) return a; return gcd(b,a%b);}int euler_phi(int n){ int res=1; for(int i=2;i*i<=n;i++)原创 2016-08-14 16:40:34 · 857 阅读 · 0 评论