可以先看

置换群burnside引理(bzoj 1004: [HNOI2008]Cards)

Polya定理公式(必须在没有限制下才能使用此公式):

其中|G|为总置换数,m表示可用的颜色数,c(gi)为第i种置换的循环节个数

Let it Bead
Time Limit: 1000MS   Memory Limit: 65536K
Total Submissions: 6079   Accepted: 4072

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 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.

Input

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.

Output

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.

Sample Input

1 1
2 1
2 2
5 1
2 5
2 6
6 2
0 0

Sample Output

1
2
3
5
8
13
21

题意:

你有m种颜色的珠子无数个,问能用这些珠子做出多少种不同的周长为n的珍珠项链

如果两个项链能通过翻转和旋转变成一样,那么这两种项链就当做是同一种

Polya模板题

求出所有置换循环节,假设有n颗珠子,m种颜色

①顺时针循环i颗珠子,循环节个数为Gcd(n, i)

②n为奇数时:以第i颗珠子为中心翻转,循环节个数为(n-1)/2+1

n为偶数时:以第i颗珠子为中心翻转,对面的珠子也不会动,循环节个数为(n-2)/2+2

以两颗珠子中间为中心翻转,循环节个数为n/2

置换总数|G| = 2*N

#include<stdio.h>
int Gcd(int x, int y)
{if(y==0)return x;return Gcd(y, x%y);
}
int Pow(int x, int y)
{int ans = 1;while(y){if(y%2)ans = ans*x;x = x*x;y /= 2;}return ans;
}
int main(void)
{int m, n, i, ans;while(scanf("%d%d", &m, &n), m!=0 || n!=0){ans = 0;for(i=1;i<=n;i++)ans += Pow(m, Gcd(n, i));if(n%2)ans += n*Pow(m, n/2+1);elseans += n*Pow(m, n/2+1)/2+n*Pow(m, n/2)/2;printf("%d\n", ans/(2*n));}return 0;
}

置换群Polya定理(poj 2409: Let it Bead)相关推荐

  1. POJ 2409 Let it Bead (Polya定理)

    题意 用k种颜色对n个珠子构成的环上色,旋转翻转后相同的只算一种,求不等价的着色方案数. 思路 Polya定理 X是对象集合{1, 2, --, n}, 设G是X上的置换群,用M种颜色染N种对象,则不 ...

  2. poj 2409 Let it Bead Polya计数

    旋转能够分为n种置换,相应的循环个数各自是gcd(n,i),个i=0时不动,有n个 翻转分为奇偶讨论,奇数时有n种置换,每种有n/2+1个 偶数时有n种置换,一半是n/2+1个,一半是n/2个 啃论文 ...

  3. POJ 2409 Let it Bead【Polya定理】(模板题)

    <题目链接> 题目大意: 用k种颜色对n个珠子构成的环上色,旋转.翻转后相同的只算一种,求不等价的着色方案数. 解题分析: 对于这种等价计数问题,可以用polay定理来解决,本题是一道po ...

  4. 解题报告 (五) Burnside引理和Polya定理

    Burnside引理 笔者第一次看到Burnside引理那个公式的时候一头雾水,找了本组合数学的书一看,全是概念.后来慢慢从Polya定理开始,做了一些题总算理解了.本文将从最简单的例子出发,解释Bu ...

  5. poj 2409 polya定理

    polya定理的入门题 1 #include <iostream> 2 #include <cstring> 3 #include <cstdio> 4 using ...

  6. 置换群和Burnside引理,Polya定理

    定义简化版: 置换,就是一个1~n的排列,是一个1~n排列对1~n的映射 置换群,所有的置换的集合. 经常会遇到求本质不同的构造,如旋转不同构,翻转交换不同构等. 不动点:一个置换中,置换后和置换前没 ...

  7. 【POJ 1286】Necklace of Beads(polya定理)

    [POJ 1286]Necklace of Beads(polya定理) Necklace of Beads Time Limit: 1000MS   Memory Limit: 10000K Tot ...

  8. Polya定理,Burnside引理

    涉及到组合数学的问题,首先是群的概念: 设G是一个集合,*是G上的二元运算,如果(G,*)满足下面的条件: 封闭性:对于任何a,b∈G,有a*b∈G; 结合律:对任何a,b,c∈G有(a*b)*c=a ...

  9. polya 定理总结

    公式 用cc 种颜色对 nn 个置换群G1,G2,-,GnG_1,G_2,\dots ,G_n着色,设每个置换群的循环节数为kik_i那么不同的着色总数 PG=1|G|∑ni=1ckiP_G = \f ...

最新文章

  1. C++中自定义比较函数和重载运算符总结
  2. EZ的间谍网络(codevs 4093)
  3. sklearn自学指南(part41)--使用手册的目录
  4. Atitit.  c# 语法新特性 c#2.0 3.0 4.0 4.5 5.0 6.0   attilax总结
  5. 蓝桥杯JAVA省赛2013-----B------3(振兴中华)
  6. 【OS学习笔记】六 实模式:编写主引导扇区代码
  7. php解析url的三种方法举例
  8. 开源论坛软件 NodeBB 中存在多个严重漏洞
  9. 我经历的IT公司面试及离职感受(转)
  10. KMP + 求最小循环节 --- HDU 1358 Period
  11. 十四届全国大学生“恩智浦”杯智能汽车竞赛信标组总结(1)
  12. 电脑计算机人员英语,计算机专业英语词汇新大全(完美打印版).pdf
  13. html js定义json对象,JS中的JSON对象的定义和取值实现代码
  14. 软件系统架构~思维导图
  15. IME Starters Try-outs 2018 F - First Day + G - Greatest IME
  16. 五禽戏 (中国传统健身方法)
  17. java写足球游戏_月光软件站 - 编程文档 - Java - 足球战术之flyweight篇
  18. 甲骨文服务器(Oracle Cloud)开启root用户登录
  19. Gerrit VS Gitlab
  20. 万能用户名和万能密码

热门文章

  1. python零基础能学吗-0基础该不该学习Python?适合学习吗?
  2. 如何系统的自学python-应该怎样系统的学习Python标准库?
  3. python读音-Python怎么读
  4. 主进程退出后子进程还会存在吗?_[docker]从一个实例,一窥docker进程管理
  5. 项目实用-不登录就无法访问主页
  6. Vue2.0 $set()处理数据更新但视图不更新的问题(给对象添加属性必须用this.$set(this.data,”key”,value’))
  7. 交换机的基本配置实验报告_交换机入门配置,最基本的IP及登录方式配置,一分钟了解下...
  8. 蓝宝石rx580怎么超频_台式机显卡怎么选?小百科教你准确定位合理选择(3)
  9. mysql中log_mysql中log
  10. Mybatis 处理日期格式自动转换