POJ1286 Necklace of Beads(Polya定理)】的更多相关文章

题目:http://poj.org/problem?id=1286 真·Polya定理模板题: 写完以后感觉理解更深刻了呢. 代码如下: #include<iostream> #include<cstdio> #include<cstring> using namespace std; typedef long long ll; int n; ll ans; ll pw(ll a,int b) { ll ret=; ,a*=a) )ret*=a; return ret;…
Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 9359   Accepted: 3862 Description Beads of red, blue or green colors are connected together into a circular necklace of n beads ( n < 24 ). If the repetitions that are produced by rotation…
http://poj.org/problem?id=1286 题意:求用3种颜色给n个珠子涂色的方案数.polya定理模板题. #include <stdio.h> #include <math.h> long long gcd(long long a,long long b) { return b?gcd(b,a%b):a; } int main() { long long n; while(~scanf("%lld",&n)) { ) break;…
Polya定理:设G={π1,π2,π3........πn}是X={a1,a2,a3.......an}上一个置换群,用m中颜色对X中的元素进行涂色,那么不同的涂色方案数为:1/|G|*(mC(π1)+mC(π2)+mC(π3)+...+mC(πk)). 其中C(πk)为置换πk的循环节的个数. Polya定理的基础应用. 你得算出旋转和翻转时,每种置换的循环节数. 旋转时,每种置换的循环节数为gcd(n,i): 翻转时,若n为奇数,共有n个循环节数为n+1>>1的置换, 若n为偶数,共有n…
  Description Beads of red, blue or green colors are connected together into a circular necklace of n beads ( n < ). If the repetitions that are produced by rotation around the center of the circular necklace or reflection to the axis of symmetry are…
Necklace of Beads Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 7451   Accepted: 3102 Description Beads of red, blue or green colors are connected together into a circular necklace of n beads ( n < 24 ). If the repetitions that are pro…
Necklace of Beads Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1049    Accepted Submission(s): 378 Problem Description Beads of red, blue or green colors are connected together into a circula…
非常裸的polya,只是我看polya看了非常久 吉大ACM模板里面也有 #include <cstdio> #include <cmath> #include <iostream> using namespace std; long long gcd(long long a,long long b) { return b==0?a:gcd(b,a%b); } int main() { #ifndef ONLINE_JUDGE //freopen("G:/1.…
Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 8263   Accepted: 3452 Description Beads of red, blue or green colors are connected together into a circular necklace of n beads ( n < 24 ). If the repetitions that are produced by rotation…
由于这是第一天去实现polya题,所以由易到难,先来个铺垫题(假设读者是看过课件的,不然可能会对有些“显然”的地方会看不懂): 一:POJ1286 Necklace of Beads :有三种颜色,问可以翻转,可以旋转的染色方案数,n<24. 1,n比较小,恶意的揣测出题人很有可能出超级多组数据,所以先打表. 2,考虑旋转: ;i<n;i++) sum+=pow(n,gcd(n,i)); 3,考虑翻转: ) sum+=n*pow(,n/+) ; else { sum+=n/*pow(,n/)…
Beads of red, blue or green colors are connected together into a circular necklace of n beads ( n < 24 ). If the repetitions that are produced by rotation around the center of the circular necklace or reflection to the axis of symmetry are all neglec…
Necklace of Beads Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 630    Accepted Submission(s): 232 Problem Description Beads of red, blue or green colors are connected together into a circular…
点我看题目 题意 :给你3个颜色的n个珠子,能组成多少不同形式的项链. 思路 :这个题分类就是polya定理,这个定理看起来真的是很麻烦啊T_T.......看了有个人写的不错: Polya定理: (1)设G是p个对象的一个置换群,用k种颜色突然这p个对象,若一种染色方案在群G的作用下变为另一种方案,则这 两个方案当作是同一种方案,这样的不同染色方案数为: : (2)置换及循环节数的计算方法:对于有n个位置的手镯,有n种旋转置换和n种翻转置换.对于旋转置换: c(fi) = gcd(n,i) …
http://poj.org/problem?id=1286 题意:有红.绿.蓝三种颜色的n个珠子.要把它们构成一个项链,问有多少种不同的方法.旋转和翻转后同样的属于同一种方法. polya计数. 搜了一篇论文Pólya原理及其应用看了看polya究竟是什么东东.它主要计算所有互异的组合的个数.对置换群还是似懂略懂.用polya定理解决这个问题的关键是找出置换群的个数及哪些置换群,每种置换的循环节数.像这样的不同颜色的珠子构成项链的问题能够把N个珠子看成正N边形. Polya定理:(1)设G是p…
Necklace of Beads 大意:3种颜色的珠子,n个串在一起,旋转变换跟反转变换假设同样就算是同一种,问会有多少种不同的组合. 思路:正规学Polya的第一道题,在楠神的带领下,理解的还算挺快的.代码没什么好说的,裸的Polya.也不须要优化. /************************************************************************* > File Name: POJ1286.cpp > Author: GLSilence &…
Polya定理 L=1/|G|*(m^c(p1)+m^c(p2)+...+m^c(pk)) G为置换群大小 m为颜色数量 c(pi)表示第i个置换的循环节数 如置换(123)(45)(6)其循环节数为3 ------------------------------------------------------------------------------------------- POJ1286&POJ2409 都是简单的处理串珠子的问题. 题目中隐藏着3种不同的置换类别. 1.旋转 注意不…
Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 11654   Accepted: 3756 Description Beads of N colors are connected together into a circular necklace of N beads (N<=1000000000). Your job is to calculate how many different kinds of the nec…
题目 Beads of N colors are connected together into a circular necklace of N beads (N<=1000000000). Your job is to calculate how many different kinds of the necklace can be produced. You should know that the necklace might not use up all the N colors, a…
Necklace of Beads Description Beads of red, blue or green colors are connected together into a circular necklace of n beads ( n < 24 ). If the repetitions that are produced by rotation around the center of the circular necklace or reflection to the a…
描述 "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,…
Necklace of Beads Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 7874   Accepted: 3290 Description Beads of red, blue or green colors are connected together into a circular necklace of n beads ( n < 24 ). If the repetitions that are pro…
这题和POJ-1286一样 题意: 给出t种颜色的n颗珠子 (每种颜色的珠子个数无限制,但总数必须是n), 求能制作出项链和手镯的个数 注意手镯可以翻转和旋转  而 项练只能旋转 解析: 注意Polya定理: 等价类的个数等于所有的置换f的km(f)的平均数 先考虑旋转,一共有n种情况,旋转1颗珠子构成循环,2颗,3颗·····n颗,那么对于旋转i颗珠子有gcd(i,n)个循环,那么根据Polya定理  置换的不动点的个数为 a = sum(tgcd(i, n)); 为什么又gcd(i, n)个…
Let it Bead Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 6443   Accepted: 4315 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 b…
转自:http://endlesscount.blog.163.com/blog/static/82119787201221324524202/ Polya定理 首先记Sn为有前n个正整数组成的集合,G为Sn的置换群,C为Sn的着色集.那么我们等于是要求C中有多少种着色方案是不等价的.定义两种着色等价的概念:如果对于在C中的两种着色c1.c2,存在置换f使得f*c1=c2,那么c1和c2就是等价的.要想求不等价着色的个数,我们要先证明一个定理,即:         Burnside定理:设G(c…
对Polya定理的个人认识     我们先来看一道经典题目:     He's Circles(SGU 294)         有一个长度为N的环,上面写着“X”和“E”,问本质不同的环有多少个(不能旋转重复就称之为本质不同) 输入样例:4 输出样例:6 那么要怎么办呢?暴力显然暴不出来…… 我们可以考虑使用置换群. 我们有两种算法: ①Burnside引理: 答案直接为1/|G|*(D(a1)+D(a2)+D(a3)+……+D(as)) 其中D(ak)为在进行置换群置换操作ak下不变的元素的…
小可可在课余的时候受美术老师的委派从事一项漆绘瓷砖的任务.首先把n(n+1)/2块正六边形瓷砖拼成三角形的形状,右图给出了n=3时拼成的“瓷砖三角形”.然后把每一块瓷砖漆成纯白色或者纯黑色,而且每块瓷砖的正.反两面都必须漆成同样的颜色. 有一天小可可突发奇想,觉得有必要试试看这些瓷砖究竟能够漆成多少种本质不同的图案.所谓两种图案本质不同就是其中的一种图案无论如何旋转.或者翻转.或者同时旋转和翻转都不能得到另外一种图案. 旋转是将瓷砖三角形整体顺时针旋转120度或240度. 翻转是将瓷砖三角形整体…
Invoker Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 122768/62768 K (Java/Others)Total Submission(s): 907    Accepted Submission(s): 364 Problem Description On of Vance's favourite hero is Invoker, Kael. As many people knows Kael can contr…
http://www.cnblogs.com/wenruo/p/5304698.html 先看 Polya定理,Burnside引理回忆一下基础知识.总结的很棒. 一个置换就是集合到自身的一个双射,置换群就是元素为置换的群. 再看 Polya入门  涨涨姿势. Burnside定理,在每一种置换群也就是等价群中的数量和除以置换群的数量,即非等价的着色数等于在置换群中的置换作用下保持不变的着色平均数. Polya定理:设 是n个对象的一个置换群, 用m种颜色染图这n个对象,则不同的染色方案数为:…
点我看题目 题意 :给你c种颜色的n个珠子,问你可以组成多少种形式. 思路 :polya定理的应用,与1286差不多一样,代码一改就可以交....POJ 1286题解 #include <stdio.h> #include <iostream> #include <string.h> #include <math.h> #include <algorithm> using namespace std; int gcd(int a,int b) {…
Necklace of Beads Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 7763   Accepted: 3247 Description Beads of red, blue or green colors are connected together into a circular necklace of n beads ( n < 24 ). If the repetitions that are pro…