zoukankan      html  css  js  c++  java
  • hdu 4633 Who's Aunt Zhang(polya+逆元)

    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

     1 #include <iostream>
     2 #include<stdio.h>
     3 #include<string.h> 
     4 #include <cstdio>
     5 #include <algorithm>
     6 #include <cmath>
     7 #include <cstring>
     8 using namespace std;
     9 const int mo=10007;
    10 
    11 int q(int a,int b)
    12 {
    13     int ans=1;
    14     a%=mo;
    15     while(b)
    16     {
    17         if(b&1)
    18         {
    19             ans=ans*a%mo;
    20             b--;
    21         }
    22         b>>=1;
    23         a=a*a%mo;
    24     }
    25     return ans;
    26 }
    27 
    28 int main()
    29 {
    30     int ca,i,j,T,k;
    31     scanf("%d",&T);
    32     for(ca=1;ca<=T;ca++)
    33     {
    34         scanf("%d",&k);
    35         int ans=0;
    36         ans+=q(k,74);//不转 
    37         
    38         ans+=q(k,20)*3+q(k,20)*3;//面面90与270度;         
    39         ans+=q(k,38)*3;//面面180度; 
    40         
    41         ans+=q(k,38)*6;//対棱180;
    42         
    43         ans+=q(k,26)*4+ q(k,26)*4;//对顶;
    44         
    45         ans%=mo;
    46         ans*=q(24,mo-2);
    47         ans%=mo;
    48         
    49         printf("Case %d: ",ca); 
    50         printf("%d
    ",ans); 
    51          
    52     }
    53     
    54 }
    View Code
  • 相关阅读:
    摩托罗拉挪动诉TiVo数字录像手艺专利侵权
    动静称Verizon三月末推出WP7手机
    2月25日中国观点股全线下跌 优酷网涨7.06%
    Verizon CEO称C版iPhone销售微弱
    外来往戏出海案例:热酷日本掘金之路
    摩根大通旗下基金或以4.5亿美元入股Twitter
    TCL通讯2010年净利润6.11亿元 同比增200%
    马克·扎克伯格和Facebook星球
    2月25日中国观点股评级:维持网易买入评级
    美媒评全球十家增速最快IT办事公司 当当网居首
  • 原文地址:https://www.cnblogs.com/skykill/p/3233488.html
Copyright © 2011-2022 走看看