Who's Aunt Zhang(hdu4633,polay定理)

来源:互联网 发布:好用的补水乳液 知乎 编辑:程序博客网 时间:2024/05/16 18:41

http://acm.hdu.edu.cn/showproblem.php?pid=4633

Who's Aunt Zhang

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)

Total Submission(s): 180    Accepted Submission(s): 146

Problem Description

Aunt Zhang, well known as 张阿姨, is a fan of Rubiks 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 cubes 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 Rubiks cube is consists of nine small faces. Aunt Zhang can color arbitrary color as she like which means that she doesnt 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)

 

Input

The first line of the date is an integer T, which is the number of the text cases.

Then T cases follow, each case contains one integer K, which is the number of colors. T<=100, K<=100.

 

Output

For each case, you should output the number of different cubes.

Give your answer modulo 10007.

 

Sample Input

3

1

2

3

 

Sample Output

Case 1: 1

Case 2: 1330

Case 3: 9505

 

Source

2013 Multi-University Training Contest 4

 

Recommend

zhuyuanchen520

 

解析:

思路:利用polay定理和置换群求解方案数

直接用了以下这个大神的结论过的;

http://blog.csdn.net/huangshenno1/article/details/9708207

根据Burnside引理,等价类数目等于所有 的不动点数目 C ( f ) 的平均值。

本题模型共有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

0MS 228K 586 B C++

*/


#include<stdio.h>#include<string.h>#include<math.h>#include<algorithm>using namespace std;const int mod=10007;int pow_mod(int a,int b){if(b==0)return 1;int x=pow_mod(a,b/2);long long ans=(long long)x*x%mod;if(b%2==1)ans=ans*a%mod;return (int)ans;}int main(){int T,k,ans,c=0;scanf("%d",&T);while(T--){scanf("%d",&k); ans=(pow_mod(k,74)+pow_mod(k,20)*6+pow_mod(k,38)*9+pow_mod(k,26)*8)%mod;// printf("%d\n",ans); ans=(ans*pow_mod(24,mod-2))%mod; printf("Case %d: ",++c); printf("%d\n",ans);}return 0;}


原创粉丝点击