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. Oracle开发:创建一个用户并分配表空间和分配权限

    -- 创建一个用户并分配表空间和分配权限 -- 以sysdba登录 oracle@sha-col-oracle-2:~> sqlplus / as sysdba SQL*Plus: Releas ...

  2. 五、RF中UI自动化操作基础

    列表分类 1.打开浏览器 Open Browser   url   browser [ url | browser=firefox | alias=None | remote_url=False | ...

  3. docker常用软件安装及使用

    linux安装docker: sudo wget -qO- https://get.docker.com | sh 启动docker: service docker start 搜索镜像: docke ...

  4. IDEA集成Tomcat启动控制台乱码

    解决方法: 在下图位置加上: -Dfile.encoding=UTF-8 然后安装下图设置: 如果上述方法重启tomcat还是乱码,那么: 进入idea的安装目录, 进入bin目录下.找到idea.e ...

  5. EDM邮件营销的七个重要参考指标

    如何做好EDM邮件营销,已经成为EDM工作人员面临的实际问题.当你发送邮件之前, 你可以先想想:我自己的电子邮件的目标是什么?邮件能否吸引收件人?能带来更多客户吗?无论你的目标是什么,以下的这些指标是 ...

  6. HTM基础之HTML标签

    HTML(超文本标记语言) html代码实际上就是一套能够被浏览器所识别的规则代码,由一个个标签组成.html代码就是一大长串字符串,而这种字符串的格式正好能够被浏览器所识别,也就有了我们的WEB页面 ...

  7. Mysql的caching_sha2_password的坑

    概述 今天我用homebrew安装Mysql8.0,安装完成之后,用Workbench和Sequel Pro连接数据库都失败了,并且都报caching_sha2_password相关的错误,经过查资料 ...

  8. oracle ogg--ogg搭建过程中遇到的错误及处理

    1 PRVF-0002 : Could not retrieve local nodename---# Begin Stacktrace #---------------------------ID: ...

  9. IIS安全狗问题

    1.没有安装以前网站运行正常,安装IIS全狗以后,ajaxpro2出现,找不到任何问题,卸载安全狗以后正常. 2.很久以前遇到的一个问题,有一款NET的cms系统,也是安装了安全狗以后不正常,忘记了c ...

  10. 工具类分享之获取Request/Response工具类《RequestContextHolderUtil》

    版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/aiyaya_/article/details/78975893前言在开发spring web项目时, ...