hdu 4633 Who's Aunt Zhang polya计数法
来源:互联网 发布:数据集成架构 编辑:程序博客网 时间:2024/05/02 01:33
Aunt Zhang, well known as 张阿姨, is a fan of Rubik’s cube. One day she buys a new one and would like to color it as a gift to send to Teacher Liu, well known as 刘老师. As Aunt Zhang is so ingenuity, she can color all the cube’s points, edges and faces with K different color. Now Aunt Zhang wants to know how many different cubes she can get. Two cubes are considered as the same if and only if one can change to another ONLY by rotating the WHOLE cube. Note that every face of Rubik’s cube is consists of nine small faces. Aunt Zhang can color arbitrary color as she like which means that she doesn’t need to color the nine small faces with same color in a big face. You can assume that Aunt Zhang has 74 different elements to color. (8 points + 12 edges + 9*6=54 small faces)
之前学过burnside引理和polya计数法,这题太明显是polya计数法的应用了,比赛的时候刚开始我只考虑了十种置换,后来想出应该是有24种的。。。不过由于要搞其他题,在这题上已经花了一定时间了,还是没继续搞了。赛后终于把所有情况给弄出来了,把k代入再利用扩展欧几里得求个逆元可以了。。。下次要果断!
#include <stdio.h>#define LL __int64const int mod = 10007;LL p[111];LL exgcd(LL a, LL b, LL &x, LL &y) {if(b==0) {x = 1;y = 0;return a;}LL ans = exgcd(b, a%b, y, x);y = y - a/b*x;return ans;}int main() {int i,k;int t, cas = 1;scanf("%d", &t);while(t--) {scanf("%d", &k);printf("Case %d: ", cas++);p[1] = k;for(i =2;i <= 100; i++)p[i] = p[i-1]*k%mod;LL ans = p[74]+(p[20]+p[20]+p[38])*3 + 8*p[26] + 6*p[38];LL x, y;LL d = exgcd(24, mod, x, y);x = (x%mod+mod)%mod;printf("%I64d\n", ans*x%mod);}return 0;}
- hdu 4633 Who's Aunt Zhang polya计数法
- hdu 4633 Who's Aunt Zhang 【polya计数】
- HDU 4633 Who's Aunt Zhang (Polya定理)
- hdu 4633 Who's Aunt Zhang(polya)
- Who's Aunt Zhang HDU
- HDU 4633 Who's Aunt Zhang (Polya定理+快速幂)
- HDU4633 Who's Aunt Zhang
- hdu 4633 Who's Aunt Zhang(Burnside引理+乘法逆元)
- Who's Aunt Zhang(hdu4633,polay定理)
- hdu 3547(Polya计数)
- hdu 3869 polya计数
- HDU 3441 Rotation(Polya计数)
- sgu294:He's Circles(polya计数+高精度)
- hdu 1812 Count the Tetris polya计数
- Polya计数
- Polya计数
- polya 计数法,burnside定理 学习小结
- Polya计数法总结 POJ2409&&2154&&SGU282
- Android跳转系统联系人界面插入联系人 传真\地址\邮箱\职位\部门\邮编\照片
- 交换机端口类型
- Hibernate3.x调用存储过程
- 主题模型-LDA浅析
- Exception in thread "main" java.lang.ExceptionInInitializerError
- hdu 4633 Who's Aunt Zhang polya计数法
- NSString 常用
- The word is not correctly spelled问题解决
- printf 格式化输出
- Spring MVC 直接访问静态文件(html、jpg、js...)
- Linux下压缩包的解压
- restrict关键字
- 正确计算linux系统内存使用率
- oracle 11g expdp impdp详细使用方法