编程介的小学生 2017-11-18 13:43 采纳率: 20.5%
浏览 780
已结题

Who's Aunt Zhang

Problem Description
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)

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

  • 写回答

1条回答 默认 最新

  • 银河曼巴 2018-07-23 14:04
    关注

    之前学过burnside引理和polya计数法,这题太明显是polya计数法的应用了。把k代入再利用扩展欧几里得求个逆元可以了。

    #include
    #define LL __int64

    const 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;
    }

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog