hdu 4633 Who's Aunt Zhang polya计数法

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



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值