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. npm-package-lock.json

    npm notice created a lockfile as package-lock.json. You should commit this file. https://docs.npmjs. ...

  2. C++中cout输出字符串和字符串型指针地址值的方法以及C语言中的printf用法比较

    #include <iostream> using namespace std; #include <stdio.h> int main() { char *pstr = &q ...

  3. mysql查询时特殊字符转译

    commons.lang String value = StringEscapeUtils.escapeSql(searchRequest.getSearchValue());

  4. 存取code 操作内容

    笔记! 实现: 前端: 首先导航需要给他们code(主键): <foreach name="chaa" item="ab"> <if cond ...

  5. 我们建了一个 Golang 硬核技术交流群(内含视频福利)

    目录 目录 Golang 是什么? 我们为什么选择 Golang? Golang 是云时代的宠儿! 我们搞了一场 Golang 入门直播 Golang 是什么? Golang 是谷歌 2009 年发布 ...

  6. centos官网镜像下载方法

    1.CentoS简介 CentOS(Community Enterprise Operating System,社区企业操作系统)是一个基于Red Hat Linux 提供的可自由使用源代码的企业级L ...

  7. java中? extends T 和? super T解析

    转:https://blog.csdn.net/qq_25337221/article/details/81669630 PECS原则 最后看一下什么是PECS(Producer Extends Co ...

  8. JMV监控工具之JConsole

    一.简介 JConsole是一个基于JMX的GUI工具,用于连接正在运行的JVM,它是Java自带的简单性能监控工具.下面以对tomcat的监控为例,带领大家熟悉JConsole这个工具. 二.配置 ...

  9. ArchLinux下XFCE的一个问题修复:thunar加载的环境变量不正确

    家里的电脑上,安装了Arch32与Arch64.不记得以前做过什么操作, 导致在Arch32下,Thunar启动后,其环境变量缺失很多内容. 主要在PATH及LD_LIBRARY_PATH几个关键变量 ...

  10. Babel编译:类

    编译前 class Fruit{ static nutrition = "vitamin" static plant(){ console.log('种果树'); } name; ...