题目地址: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个循环,面18个循环)x2(120和240度两种)x4(4组对角顶点)

3、通过两个对立面的中心,分别旋转90,180,270度。有3组面

在每次旋转90度和270度的时候(顶点2个循环节,边3个循环节,面15个循环节)x2(90和270两种角度)x3(三组对立面)

在每次旋转180度的时候(顶点4个循环节,边6个循环节,面28个循环节)x1(只有180度)x3(三组对里面)

4、通过两条对立的棱的中心,分别旋转180度,有6组棱(顶点4个循环节,边7个循环节,面27个循环节)×1(180度)×6(6组对立棱)

AC代码:

#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <list>
#include <deque>
#include <queue>
#include <iterator>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <cctype>
using namespace std; typedef long long LL;
const int N=1;
const int mod=10007;
const int INF=0x3f3f3f3f;
const double PI=acos(-1.0); int powmod(int a,int b)
{
int ans=1;
while(b)
{
if(b&1) ans=(ans*a)%mod;
a=(a*a)%mod;
b>>=1;
}
return ans;
} int main()
{
int i,j,t,k,ca=0;
scanf("%d",&t);
while(t--)
{
scanf("%d",&k);
int xh=0;
xh=(xh+powmod(k,74))%mod;
xh=(xh+6*powmod(k,20))%mod;
xh=(xh+3*powmod(k,38))%mod;
xh=(xh+6*powmod(k,38))%mod;
xh=(xh+8*powmod(k,26))%mod;
xh=(xh*powmod(24,mod-2))%mod;
printf("Case %d: %d\n",++ca,xh);
}
return 0;
}
/*
本题模型共有4大类置换,共24种:
1. 不做任何旋转 K ^ (54 + 12 + 8)
2. 绕相对面中心的轴转
1) 90度 K ^ (15 + 3 + 2) * 3
1) 180度 K ^ (28 + 6 + 4) * 3
1) 270度 K ^ (15 + 3 + 2) * 3
3. 绕相对棱中心的轴转
1) 180度 K ^ (27 + 7 + 4) * 6
4. 绕相对顶点的轴转
1) 120度 K ^ (18 + 4 + 4) * 4
1) 240度 K ^ (18 + 4 + 4) * 4
*/

HDU 4633 Who's Aunt Zhang (Polya定理+快速幂)的更多相关文章

  1. HDU 4633 Who's Aunt Zhang ★(Polya定理 + 除法取模)

    题意 用K个颜色给魔方染色,魔方只能整体旋转并且旋转重合的方案算一种,求一共有多少不同的染色方案. 思路 经典的Polya应用,记住正六面体的置换群就可以了,魔方就是每个大面变成9个小面了而已: 本题 ...

  2. HDU 4633 Who's Aunt Zhang (2013多校4 1002 polya计数)

    Who's Aunt Zhang Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  3. hdu 4633 Who's Aunt Zhang(polya+逆元)

    Who's Aunt Zhang Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  4. hdu 4704 sum(费马小定理+快速幂)

    题意: 这题意看了很久.. s(k)表示的是把n分成k个正整数的和,有多少种分法. 例如: n=4时, s(1)=1     4 s(2)=3     1,3      3,1       2,2 s ...

  5. HDU 4704 Sum( 费马小定理 + 快速幂 )

    链接:传送门 题意:求 N 的拆分数 思路: 吐嘈:求一个数 N 的拆分方案数,但是这个拆分方案十分 cd ,例如:4 = 4 , 4 = 1 + 3 , 4 = 3 + 1 , 4 = 2 + 2 ...

  6. HDU 4633 Who's Aunt Zhang(polay计数)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4633 题意:有下面一个魔方.有K种颜色.可以为顶点.边.面(每个面有9个小面)染色.两种染色算作一种当 ...

  7. 组合数(Lucas定理) + 快速幂 --- HDU 5226 Tom and matrix

    Tom and matrix Problem's Link:   http://acm.hdu.edu.cn/showproblem.php?pid=5226 Mean: 题意很简单,略. analy ...

  8. poj 2888 Magic Bracelet(Polya+矩阵快速幂)

    Magic Bracelet Time Limit: 2000MS   Memory Limit: 131072K Total Submissions: 4990   Accepted: 1610 D ...

  9. hdu 1817 Necklace of Beads(Polya定理)

    Necklace of Beads Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others ...

随机推荐

  1. Google Chrome浏览器的使用方法

    Google Chrome浏览器 [原文地址:http://www.cnblogs.com/QLeelulu/archive/2011/08/28/2156402.html ] 在Google Chr ...

  2. MAC环境下生成Apple证书教程

    在MAC操作系统下,生成Apple证书比较简单,全图形化操作. 一.使用Keychain Access(钥匙串访问) MAC操作系统对证书的处理都采用了“Keychain Access”(中文系统名为 ...

  3. C#.NET中的CTS、CLS和CLR

    以下内容来自:http://www.cnblogs.com/zagelover/articles/2741370.html 在学习.NET的过程中,都会不可避免地接触到这三个概念,那么这三个东西是什么 ...

  4. C++ 下 typeof 的实现

    现在我们有这样一坨代码: std::vector<int> arr; // ... for(std::vector<int>::iterator iter = arr.begi ...

  5. poj 3273 Monthly Expense (二分搜索,最小化最大值)

    题目:http://poj.org/problem?id=3273 思路:通过定义一个函数bool can(int mid):=划分后最大段和小于等于mid(即划分后所有段和都小于等于mid) 这样我 ...

  6. poj1862---变形虫(贪心)

    题意:两条虫之间碰在一起,质量变为2*sqrt(m1*m2) 求怎么结合,能使最后的一只虫质量最小 分析:如果让按从大到小的顺序依次结合,可以使大的数被开方的次数最多,得到的结果更小 4 3 2 1 ...

  7. 去英国Savile Row 做件私人定制手工西装_GQ男士网

    去英国Savile Row 做件私人定制手工西装_GQ男士网 去英国Savile Row 做件私人定制手工西装

  8. 网易云课堂_C语言程序设计进阶_第5周:链表

    5.1可变数组 5.2链表 5.1可变数组 Resizable Array Think about a set of functions that provide a mechanism of res ...

  9. Sequence operation(线段树区间多种操作)

    Sequence operation Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Othe ...

  10. VBA 开发学习--基础语法

    MsgBox "开始学习VBA" '提示框 Dim str As String '声明str变量是string类型 Let str = "一起来看流星雨" '给 ...