2015
09-17

# Who’s Aunt Zhang

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)

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.

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.

3
1
2
3

Case 1: 1
Case 2: 1330
Case 3: 9505

#include <iostream>
#include <string.h>
#include <stdio.h>

using namespace std;
typedef long long LL;
const LL MOD=10007;

LL quick_mod(LL a,LL b)
{
LL ans=1;
a%=MOD;
while(b)
{
if(b&1)
{
ans=ans*a%MOD;
b--;
}
b>>=1;
a=a*a%MOD;
}
return ans;
}

int main()
{
LL tt=1,t,k,ans;
cin>>t;
while(t--)
{
cin>>k;
ans=quick_mod(k,74);
ans+=3*(2*quick_mod(k,20)+quick_mod(k,38))%MOD;
ans+=6*quick_mod(k,38);
ans+=8*quick_mod(k,26);
ans%=MOD;
ans*=quick_mod(24,MOD-2);
ans%=MOD;
printf("Case %I64d: %I64d\n",tt++,ans);
}
return 0;
}