hdu 4633 Who's Aunt Zhang(polya+逆元)
2024-09-05 19:39:14
Who's Aunt Zhang
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 125 Accepted Submission(s): 108
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
Source
Recommend
zhuyuanchen520
/*
本体明显的polya的应用. G为置换群总数,c(gi)为群gi的循环节。。
步骤:
先求置换种类,接着再手动画图算出循环节!!!
本题模型共有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
#include <iostream>
#include<stdio.h>
#include<string.h>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
using namespace std;
const int mo=; int q(int a,int b)
{
int ans=;
a%=mo;
while(b)
{
if(b&)
{
ans=ans*a%mo;
b--;
}
b>>=;
a=a*a%mo;
}
return ans;
} int main()
{
int ca,i,j,T,k;
scanf("%d",&T);
for(ca=;ca<=T;ca++)
{
scanf("%d",&k);
int ans=;
ans+=q(k,);//不转 ans+=q(k,)*+q(k,)*;//面面90与270度;
ans+=q(k,)*;//面面180度; ans+=q(k,)*;//対棱180; ans+=q(k,)*+ q(k,)*;//对顶; ans%=mo;
ans*=q(,mo-);
ans%=mo; printf("Case %d: ",ca);
printf("%d\n",ans); } }
最新文章
- 使用sklearn进行集成学习——实践
- UVA - 11134 Fabled Rooks[贪心 问题分解]
- BZOJ-4300 绝世好(蛋疼)题 DP(递推)
- 在windows下创建一个Mongo服务
- 关于XML的DTD概述
- linux重定向总结:如何将shell命令的输出信息自动输出到文件中保存
- thinkphp3.23整合phpexcel
- Markdown简短教程
- Asp.net管道 (第二篇)
- Oracle Day09 存储与触发器
- ( ̄y▽ ̄)~ 智能手机II
- Linux系统下安装Mysql5.7.18教程收集分享
- Swift数组的存取与修改
- Markdown 练习
- Akka(28): Http:About Akka-Http
- ajax&;bootstrap
- scala的安装及使用
- FAT32文件系统学习(1) —— BPB的理解
- 极快瑞的函数式编程,Jquery涉及的一些函数
- users命令详解