hdu-1817-polya】的更多相关文章

Different Circle Permutation Time Limit: 3000/1500 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 218    Accepted Submission(s): 106 Problem Description You may not know this but it's a fact that Xinghai Square is…
Birthday Toy Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 644    Accepted Submission(s): 326 Problem Description AekdyCoin loves toys. It is AekdyCoin’s Birthday today and he gets a special “…
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…
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…
这题模数是9937还不是素数,求逆元还得手动求. 项链翻转一样的算一种相当于就是一种类型的置换,那么在n长度内,对于每个i其循环节数为(i,n),但是由于n<=2^32,肯定不能直接枚举,所有考虑枚举gcd,对应的n/gcd就是其个数,有点容斥的思想.全部累加最后除以n就计算好染色方案了. 注意这题很卡时间,而且很玄的用long long会错,要先求出上界再枚举,循环中i*i的循环条件会很慢. /** @Date : 2017-09-18 23:33:30 * @FileName: HDU 22…
DIY CubeTime Limit: 2000/2000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 207    Accepted Submission(s): 111 Problem Description Mr. D is interesting in combinatorial enumeration. Now he want to find out the numb…
由于反射的存在,分奇偶讨论其置换的循环节数量,大数用JAVA就好了. import java.math.*; import java.util.*; public class Main{ public static void main(String[] args) { Scanner cin = new Scanner(System.in); int n, t; while(cin.hasNext()) { n = cin.nextInt(); BigInteger c = cin.nextBi…
Necklace of Beads Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 1817 Description Beads of red, blue or green colors are connected together into a circular necklace of n beads ( n < 40 ). If…
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=4633 典型的Polya定理: 思路:根据Burnside引理,等价类个数等于所有的置换群中的不动点的个数的平均值,根据Polya定理,不动点的个数等于Km(f),m(f)为置换f的循环节数,因此一次枚举魔方的24中置换,人肉数循环节数即可,注意细节,别数错了. 1.静止不动,(顶点8个循环,边12个循环,面54个循环) 2.通过两个对立的顶点,分别旋转120,240,有4组顶点,(点4个循环,边4个…
似乎是比较基础的一道用到polya定理的题,为了这道题扣了半天组合数学和数论. 等价的题意:可以当成是给正n边形的顶点染色,旋转同构,两种颜色,假设是红蓝,相邻顶点不能同时为蓝. 大概思路:在不考虑旋转同构的情况下,正n边形有fib(n+1)+fib(n-1)种染色方法(n==1特判),然后后面就是套公式了,涉及到要用欧拉定理优化,不然会T.(理论的东西看下组合数学书中polya计数部分,及数论书中欧拉函数部分中 n的约数的欧拉函数,感觉看博客不如系统的看看书,再结合一下网上一些比较基础的pol…