随笔分类 -  组合 --- 置换群与Polya定理

POJ 1286 Necklace of Beads
摘要:// 3中颜色的n个珠子 问有多少种不同数量 旋转和翻转后相同算一种 // 先考虑旋转 转i格 循环节 gcd(i,n)// 翻转的话 n为奇数 每种翻转循环节 n/2+1// n为偶数 n/2的循环节为 n/2 n/2的循环节为 (n-2)/2 +2// 最后用 polya定理#include #include using namespace std;#define LL long longLL Pow(LL a,LL b){ LL t=1; for(;b;b>>=1) { if(b&1) t=t*a; a=a*a; } retur... 阅读全文

posted @ 2014-03-30 12:06 江财小子 阅读(155) 评论(0) 推荐(0)

POJ 2154 Color
摘要:// polyya定理 题意就是n种颜色n个球 求不同染色方案 "不考虑翻转"//首先 n^gcd(n,i) i=0~n-1// n太大 求 k=gcd(n,i)的个数 枚举q|n 1~sqrt(n) 再求phi(n/q) phi(q)// #include #include using namespace std;int Pow(int a,int b,int m){ int t; a=a%m; for(t=1;b;b>>=1) { if(b&1) t=(t*a)%m; a=(a*a)%m; } return t;}int p... 阅读全文

posted @ 2014-03-28 17:07 江财小子 阅读(223) 评论(0) 推荐(0)