Burnside引理和polay计数 poj2409 Let it Bead
题目描述
"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 interested in buying colored bracelets. However, over 90 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 lengths and need not be made of beads of one color. Help the boss estimating maximum profit by calculating how many different bracelets can be produced.
A bracelet is a ring-like sequence of s beads each of which can have one of c distinct colors. The ring is closed, i.e. has no beginning or end, and has no direction. Assume an unlimited supply of beads of each color. For different values of s and c, calculate the number of different bracelets that can be made.
输入
Every line of the input file defines a test case and contains two integers: the number of available colors c followed by the length of the bracelets s. Input is terminated by c=s=0. Otherwise, both are positive, and, due to technical difficulties in the bracelet-fabrication-machine, cs<=32, i.e. their product does not exceed 32.
输出
For each test case output on a single line the number of unique bracelets. The figure below shows the 8 different bracelets that can be made with 2 colors and 5 beads.
样例输入
1 1
2 1
2 2
5 1
2 5
2 6
6 2
0 0
样例输出
1
2
3
5
8
13
21
提示

前言:
通过这道题深入了解一下burnside和polya,我尽力用简单朴素的方式理解
简述题意:
一个长为n的手镯,每个珠子可以染成k中颜色中的一种,求本质不同的染色方案有多少种?(可以旋转、翻转
burnside是用来求关于一个置换群下有多少本质不同的染色方案的
#include<cstdio>
#define ll long long
using namespace std;
int n,k;
ll ans;
ll gcd(ll a,ll b){
if(!b)return a;
return gcd(b,a%b);
}
ll ksm(ll x,ll t){
ll ans=;
for(;t;t>>=,x*=x)if(t&)ans*=x;
return ans;
}
int main(){
while(scanf("%d%d",&k,&n)){
if(n==&&k==)break;
ans=;
for(int i=;i<=n;i++)ans+=ksm(k,gcd(i,n));
if(n&)ans+=ksm(k,(n+)/)*n;
else{
ans+=ksm(k,(n+)/)*n/;
ans+=ksm(k,n/)*n/;
}
ans/=*n;
printf("%lld\n",ans);
}
return ;
}
Burnside引理和polay计数 poj2409 Let it Bead的更多相关文章
- Burnside引理和polay计数学习小记
在组合数学中有这样一类问题,比如用红蓝两种颜色对2*2的格子染色,旋转后相同的算作一种.有多少种不同的染色方案?我们列举出,那么一共有16种.但是我们发现,3,4,5,6是同一种,7,8,9,10是用 ...
- Burnside引理和Polya定理之间的联系
最近,研究了两天的Burnside引理和Polya定理之间的联系,百思不得其解,然后直到遇到下面的问题: 对颜色限制的染色 例:对正五边形的三个顶点着红色,对其余的两个顶点着蓝色,问有多少种非等价的着 ...
- Burnside引理和Polya定理
转载自:https://blog.csdn.net/whereisherofrom/article/details/79631703 Burnside引理 笔者第一次看到Burnside引理那个公式的 ...
- Burnside引理与polay定理
#Burnside引理与polay定理 引入概念 1.置换 简单来说就是最元素进行重排列 是所有元素的异议映射,即\([1,n]\)映射到\([1,n]\) \[ \begin{pmatrix} 1& ...
- polay计数原理
公式: Burnside引理: 1/|G|*(C(π1)+C(π2)+C(π3)+.....+C(πn)): C(π):指不同置换下的等价类数.例如π=(123)(3)(45)(6)(7),X={1, ...
- poj2409 Let it Bead
Let it Bead Time Limit: 1000MS M ...
- POJ 2409 Let it Bead(polay计数)
题目链接:http://poj.org/problem?id=2409 题意:给出一个长度为m的项链,每个珠子可以用n种颜色涂色.翻转和旋转后相同的算作一种.有多少种不同的项链? 思路: (1) 对于 ...
- Luogu P5564 [Celeste-B]Say Goodbye (多项式、FFT、Burnside引理、组合计数)
题目链接 https://www.luogu.org/problem/P5564 题解 这题最重要的一步是读明白题. 为了方便起见下面设环长可以是\(1\), 最后统计答案时去掉即可. 实际上就相当于 ...
- BZOJ 1488 Luogu P4727 [HNOI2009]图的同构 (Burnside引理、组合计数)
题目链接 (Luogu) https://www.luogu.org/problem/P4727 (BZOJ) https://www.lydsy.com/JudgeOnline/problem.ph ...
随机推荐
- 加壳学习笔记(三)-简单的脱壳思路&调试思路
首先一些windows的经常使用API: GetWindowTextA:以ASCII的形式的输入框 GetWindowTextW:以Unicaode宽字符的输入框 GetDlgItemTe ...
- iOS中的枚举:enum, NS_ENUM, NS_OPTIONS的使用区别
1.enum可以声明一般类型和位掩码(bitmasked)类型 例如: enum Test{// 一般枚举 TestA, TestB, TestC, }; enum{// 匿名枚举 TestA, Te ...
- [转] CV Datasets on the web
转自:CVPapers This material is presented to ensure timely dissemination of scholarly and technical wor ...
- jsp 中声明方法的使用
1.在"<%!"和"%>"之间声明方法,该方法在整个JSP页面有效.可是该方法内定义的变量仅仅在该方法内有效. 这些方法将在Java程序片中被调用, ...
- 2015南阳CCPC C - The Battle of Chibi DP树状数组优化
C - The Battle of Chibi Description Cao Cao made up a big army and was going to invade the whole Sou ...
- 将分布式-队列的实现交给redis
import requestsimport reimport timefrom redis import Redisimport threading REDIS_HOST, REDIS_PORT, P ...
- Protected vs protected internal (Again) in c#
http://stackoverflow.com/questions/22940317/protected-vs-protected-internal-again-in-c-sharp protect ...
- [Codeforces Round495B] Sonya and Exhibition
[题目链接] https://codeforces.com/contest/1004/problem/B [算法] 不难发现 , 最优解一定是01010101.... 时间复杂度 : O(N) [代码 ...
- Java中static final 与 final 的区别(转载)
转自:http://advance0683.iteye.com/blog/1107732 Java中static final 与 final 的区别: 例子: Java代码 import java.u ...
- [Swift通天遁地]五、高级扩展-(9)颜色、设备、UserDefaults、URL等扩展方法
★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★➤微信公众号:山青咏芝(shanqingyongzhi)➤博客园地址:山青咏芝(https://www.cnblogs. ...