poj 2049 Let it Bead(polya模板)】的更多相关文章

  Description Cannery Row percent of the target audience insists that the bracelets be unique. (Just imagine what happened if two women showed up at the same party wearing identical bracelets!) It's a good thing that bracelets can have different leng…
题意 用k种颜色对n个珠子构成的环上色,旋转翻转后相同的只算一种,求不等价的着色方案数. 思路 Polya定理 X是对象集合{1, 2, --, n}, 设G是X上的置换群,用M种颜色染N种对象,则不同的染色方案数为: λ(g)表示置换g的轮换个数,且λ(g) = λ1(g) + λn(g) + -- + λn(g),其中λi(g)表示g中长度为i的轮换(循环)个数. 本题是对一个n个珠子的圆珠的颜色,而圆珠的置换群有: Ⅰ翻转:1.当n为奇数时,有n种翻转,每种翻转的轴都是一个顶点和该顶点对边…
旋转能够分为n种置换,相应的循环个数各自是gcd(n,i),个i=0时不动,有n个 翻转分为奇偶讨论,奇数时有n种置换,每种有n/2+1个 偶数时有n种置换,一半是n/2+1个,一半是n/2个 啃论文,PPT,各种书好久才看懂Polya定理,近期做数学题做的严重怀疑自己的智商. #include <iostream> #include <cstdio> #include <cstdlib> #include<algorithm> #include<ma…
参考:https://blog.csdn.net/sr_19930829/article/details/38108871 #include <iostream> #include <string.h> using namespace std; int c,n;//c种颜色,n个珠子 int ans; int gcd(int a,int b) { ?a:gcd(b,a%b); } int power(int p,int n)//快速幂求公式里的k的nc(g)次方 { ; while…
题目:https://www.lydsy.com/JudgeOnline/problem.php?id=1004 http://poj.org/problem?id=2409 学习材料:https://www.cnblogs.com/nietzsche-oier/p/6883880.html https://files-cdn.cnblogs.com/files/HocRiser/Burnside.pdf bzoj 1004:这道题注意考虑单位元的那个置换. 然后用 polya 定理即可.不动点…
http://poj.org/problem?id=2406 只是模板,但是有趣的是一个strcmp的字符串比较函数,学习到了... https://baike.baidu.com/item/strcmp/5495571?fr=aladdin ↑百度的概念 像 poj1961 但是更简单..主要是告诫我要学习一下str相关的函数,似乎说要学str函数好久了也没有经常用过 代码 #include<cstdio> #include<cstring> #include<iostre…
题目:https://www.lydsy.com/JudgeOnline/problem.php?id=1004 关于置换群:https://www.cnblogs.com/nietzsche-oier/p/6883880.html https://files-cdn.cnblogs.com/files/HocRiser/Burnside.pdf 原来 burnside 引理中的“不动点”是指一种不变化的方案啊: 这道题就用 burnside 引理,但给出的 m 个置换还不是置换群,需要再加一个…
poj 2049(二分+spfa判负环) 给你一堆字符串,若字符串x的后两个字符和y的前两个字符相连,那么x可向y连边.问字符串环的平均最小值是多少.1 ≤ n ≤ 100000,有多组数据. 首先根据套路,二分是显然的.然后跑一下spfa判断正环就行了. 然而我被no solution坑了十次提交.. #include <cctype> #include <cstdio> #include <cstring> using namespace std; const in…
<题目链接> 题目大意:用k种颜色对n个珠子构成的环上色,旋转.翻转后相同的只算一种,求不等价的着色方案数. 解题分析: 对于这种等价计数问题,可以用polay定理来解决,本题是一道polay定理的模板题. 具体polay定理的实现步骤如下(选自算法入门经典训练指南  147页): #include<iostream> #include<stdio.h> using namespace std; typedef long long LL; int n, m; int g…
题目传送:http://poj.org/problem?id=2409 Description "Let it Bead" company is located upstairs at 700 Cannery Row in Monterey, CA. As you can deduce from the company name, their business is beads. Their PR department found out that customers are inte…