题目传送: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…
两种置换 旋转:有n种,分别是旋转1个2个--n个,旋转i的循环节数位gcd(i,n) 翻转:分奇偶,对于奇数个,只有一个珠子对一条边的中点,循环节数为n/2+1:对于偶数个,有珠子对珠子和边对边,循环节个数为n/2+1个和n/2个 然后用polya定理即可 #include<iostream> #include<cstdio> using namespace std; long long n,k,ans; long long ksm(long long a,long long b…
<题目链接> 题目大意:用k种颜色对n个珠子构成的环上色,旋转.翻转后相同的只算一种,求不等价的着色方案数. 解题分析: 对于这种等价计数问题,可以用polay定理来解决,本题是一道polay定理的模板题. 具体polay定理的实现步骤如下(选自算法入门经典训练指南 147页): #include<iostream> #include<stdio.h> using namespace std; typedef long long LL; int n, m; int g…