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 ...
随机推荐
- android 通过子线程跳转activity并传递内容
android 子线程中不能够更新ui已经根深蒂固在我的脑海里,当时也就理所当然的觉得子线程中也是不能够进行界面的跳转的,可是在后来的学习中,发现居然是能够通过子线程来进行activity的跳转时,立 ...
- ubuntu拨号上网以及路由设置
1.宽带拨号 配置宽带连接信息:pppoeconf 拨号:pon dsl-provider 断开连接:poff dsl-provider 查看拨号日志:plog 2.路由设置 以下为rc.local文 ...
- Parallel and Perpendicular
题目链接 题意: 输入n,求正n边形中的对角线1和对角线2的个数(对角线1:至少与其它一个对角线平行:对角线2:至少与其它一个对角线垂直).对角线不能是多边形的边 (4 ≤ n ≤ 10e5) 分析: ...
- Codeforces Beta Round #67 (Div. 2)C. Modified GCD
C. Modified GCD time limit per test 2 seconds memory limit per test 256 megabytes input standard inp ...
- 【HDU1530】【ZOJ1492】Maximum Clique
Position: http://poj.org/problem?id=3241 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCod ...
- git ldap
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md ldap : enabled : true host : 'ope ...
- js获取后台数据
<!DOCTYPE html><html> <head> <meta charset="UTF-8"> <title>& ...
- 如何判断js的变量的数据类型
文章首发: http://www.cnblogs.com/sprying/p/4349426.html 本文罗列了一般的Js中类型检测的方法,实际上是每个新手在构建Js知识体系时,都要知晓的,而我只是 ...
- RocketMQ(2)
1. 消费端集群消费(负载均衡) 示例代码: /** * Producer,发送消息 * */ public class Producer { public static void main(Stri ...
- JavaScript--Array 数组对象
Array 数组对象 数组对象是一个对象的集合,里边的对象可以是不同类型的.数组的每一个成员对象都有一个“下标”,用来表示它在数组中的位置,是从零开始的 数组定义的方法: 1. 定义了一个空数组: v ...