SCOJ 4423: Necklace polya】的更多相关文章

4423: Necklace 题目连接: http://acm.scu.edu.cn/soj/problem.action?id=4423 Description baihacker bought a necklace for his wife on their wedding anniversary. A necklace with N pearls can be treated as a circle with N points where the distance between any…
4423: Necklace Description baihacker bought a necklace for his wife on their wedding anniversary. A necklace with N pearls can be treated as a circle with N points where the distance between any two adjacent points is the same. His wife wants to colo…
题意:给你n个珠子可以染成k种颜色,旋转后相同的视为一种,问共有几种情况 思路:开始按照一般的排列组合做发现情况太多且要太多运算,查了下发现此题是组合中Polya定理模板题- 学的浅只能大致一说公式Sigma(k^gcd(i-1,n))/n求和数量取决于置换群数量,由于这个成环共有n个置换群,而GCD是求当前置换群的等价置换的数量. 注意由于最后要除n,如果直接取模会出现问题.通过费马小定理求得乘法逆元为pow(n,p-2)%p; 其中p为质数. #include <stdio.h> #inc…
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 axis of symmetry ar…
  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…
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 大意:3种颜色的珠子,n个串在一起,旋转变换跟反转变换假设同样就算是同一种,问会有多少种不同的组合. 思路:正规学Polya的第一道题,在楠神的带领下,理解的还算挺快的.代码没什么好说的,裸的Polya.也不须要优化. /************************************************************************* > File Name: POJ1286.cpp > Author: GLSilence &…
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…
题目:http://poj.org/problem?id=2409 题意:用k种不同的颜色给长度为n的项链染色 网上大神的题解: 1.旋转置换:一个有n个旋转置换,依次为旋转0,1,2,```n-1.对每一个旋转置换,它循环分解之后得到的循环因子个数为gcd(n,i). 2.翻转置换:分奇偶讨论. 奇数的时候 翻转轴 = (顶点+对边终点的连线),一共有n个顶点,故有n个置换,且每个置换分解之后的因子个数为n/2+1; 偶数的时候 翻转轴 = (顶点+顶点的连线),一共有n个顶点,故有n/2个置…