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

hdu 4633 Who's Aunt Zhang(polya+逆元)的更多相关文章

  1. HDU 4633 Who's Aunt Zhang ★(Polya定理 + 除法取模)

    题意 用K个颜色给魔方染色,魔方只能整体旋转并且旋转重合的方案算一种,求一共有多少不同的染色方案. 思路 经典的Polya应用,记住正六面体的置换群就可以了,魔方就是每个大面变成9个小面了而已: 本题 ...

  2. HDU 4633 Who's Aunt Zhang (2013多校4 1002 polya计数)

    Who's Aunt Zhang Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  3. HDU 4633 Who's Aunt Zhang (Polya定理+快速幂)

    题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=4633 典型的Polya定理: 思路:根据Burnside引理,等价类个数等于所有的置换群中的不动点的个 ...

  4. HDU 4633 Who's Aunt Zhang(polay计数)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4633 题意:有下面一个魔方.有K种颜色.可以为顶点.边.面(每个面有9个小面)染色.两种染色算作一种当 ...

  5. hdu 5868:Different Circle Permutation 【Polya计数】

    似乎是比较基础的一道用到polya定理的题,为了这道题扣了半天组合数学和数论. 等价的题意:可以当成是给正n边形的顶点染色,旋转同构,两种颜色,假设是红蓝,相邻顶点不能同时为蓝. 大概思路:在不考虑旋 ...

  6. HDU 5145 NPY and girls 莫队+逆元

    NPY and girls Problem Description NPY's girlfriend blew him out!His honey doesn't love him any more! ...

  7. 2013 Multi-University Training Contest 4 Who's Aunt Zhang

    看题就知道要用polya,但是当时没做出来,还是不是很熟悉polya!!! 总共有24种置换: 1. 不做任何旋转 K ^ (54 + 12 + 8) 2. 绕相对面中心的轴转 1) 90度 K ^ ...

  8. HDU 4828 Grids(卡特兰数+乘法逆元)

    首先我按着我的理解说一下它为什么是卡特兰数,首先卡特兰数有一个很典型的应用就是求1~N个自然数出栈情况的种类数.而这里正好就对应了这种情况.我们要满足题目中给的条件,数字应该是从小到大放置的,1肯定在 ...

  9. hdu 5407【LCM性质】+【逆元】(结论题)

    <题目链接> <转载于 >>> > Problem Description CRB has N different candies. He is going ...

随机推荐

  1. mysql命令使用2

    mysql查询默认不区分大小写,如果需要区分大小写,使用binary mysql>select * from teacher where binary name='niu'; mysql查询默认 ...

  2. 方法一破解:Excel工作表保护密码

    在excel2016中实测验证过有效 在Excel中,为了保护自已的工作表不被修改,我们可以添加保护密码. 操作步骤: 1.把Excel文件的扩展名xlsx修改为Rar.瞬间Excel文件变成了压缩包 ...

  3. RaspberryPI 3b 技术总结(包括Linux)

    安装系统,无屏幕,无网线,windows下 第一步当然是把ROM(官方系统)和刷写工具备好,TF卡一张,当然必须有读卡设备. 启动Etcher,将ROM刷入TF卡,这需要挺长一段时间,完毕后将会出现四 ...

  4. 关于加快INSERT语句执行速度和HINT /*+ append */及/*+ append nologging */的使用

    (非归档模式下)创建表T01: SQL> create table t01 as select * from dba_objects where 1=2; Table created. (非归档 ...

  5. LeetCode All in One 题目讲解汇总(转...)

    终于将LeetCode的免费题刷完了,真是漫长的第一遍啊,估计很多题都忘的差不多了,这次开个题目汇总贴,并附上每道题目的解题连接,方便之后查阅吧~ 如果各位看官们,大神们发现了任何错误,或是代码无法通 ...

  6. BigDecimal进行加减乘除计算

    以前大部分关于查询计算的逻辑是在sql语句中执行的,但是有时候会出现比较复杂的计算情况,需要我们在代码中进行计算,这个时候使用BigDecimal进行计算会很方便. BigDecimal num1 = ...

  7. Grass Planting

    大致题意: 维护一棵树,支持两种操作: P x y x到y路径上的每条边的值+1:Q x y 询问x到y路径上所有边的值的和.Input第一行两个正整数,N,M表示点数和操作数:接下来N-1行每行两个 ...

  8. Ubuntu 16.04简单配置备忘录

    1.几个安装包的地址 1.Linux QQ:https://im.qq.com/linuxqq/index.html 2.网易云音乐:http://s1.music.126.net/download/ ...

  9. RocketMQ事务性消息及持久化

    TransactionProducer(事务消息): 在分布式系统中,我们时常会遇到分布式事务的问题,除了常规的解决方案之外,我们还可以利用RocketMQ的事务性消息来解决分布式事务的问题.Rock ...

  10. QQ管理

    ##用例1:查询数据 #01.查询QQ号码为54789625的所有好友信息,包括QQ号码,昵称,年龄 # # SELECT `relation`.RelationQQID AS QQ号码,`basei ...