高精度+polya原理可以搞定

思路:

设边长为n的正方形,c种颜色。
旋转只有 0,90,180,270度三种旋法。
旋0度,则置换的轮换数为n*n
旋90度,n为偶数时,则置换的轮换数为n*n/4,n为奇数,则置换的轮换数为(n*n-1)/4+1
旋180度,n为偶数时,则置换的轮换数为n*n/2,n为奇数,则置换的轮换数为(n*n-1)/2+1
旋270度,n为偶数时,则置换的轮换数为n*n/4,n为奇数,则置换的轮换数为(n*n-1)/4+1

反射 沿对角反射两种,沿对边中点连线反射两种
n为偶数时,沿对边中点连线反射两种的置换轮换数为 n*n/2
                     沿对角反射两种的置换轮换数为 (n*n-n)/2+n
n为奇数时,沿对边中点连线反射两种的置换轮换数为 (n*n-n)/2+n
                     沿对角反射两种的置换轮换数为 (n*n-n)/2+n
综上所述:用m种颜色给n*n矩形染色的方案数L
   S=m^(n*n)+m^((n*n+3)/4)+m^((n*n+1)/2)+m^((n*n+3)/4) (考虑旋转时)
n为奇数L= (S+4*m^((n*n+n)/2)) / 8
n为偶数L= (S+2*m^((n*n+n)/2)+2*m(n*n/2) )/ 8……

这个用Java写的很方便

import java.io.*; import java.util.*;
import
java.math.*;

public class Main
{

    public static
void main(String args[]) throws Exception
    {

        Scanner
cin=new Scanner(System.in);
        int
n,s1,s2,s;
BigInteger
c;
                sum=sum.add(c.pow(s2).multiply(two));
                sum=sum.add(c.pow(s).multiply(two));
            }

            sum=sum.divide(eight);
            System
.out.println(sum.toString());
        }
    }
}

hdu 1812 Count the Tetris的更多相关文章

  1. ACM: hdu 1811 Rank of Tetris - 拓扑排序-并查集-离线

    hdu 1811 Rank of Tetris Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & % ...

  2. HDU 3336 Count the string(KMP的Next数组应用+DP)

    Count the string Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  3. hdu 1811 Rank of Tetris - 拓扑排序 - 并查集

    自从Lele开发了Rating系统,他的Tetris事业更是如虎添翼,不久他遍把这个游戏推向了全球. 为了更好的符合那些爱好者的喜好,Lele又想了一个新点子:他将制作一个全球Tetris高手排行榜, ...

  4. HDU 1811 Rank of Tetris(并查集+拓扑排序 非常经典)

    Rank of Tetris Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)To ...

  5. HDU 5901 Count primes 论文题

    Count primes 题目连接: http://acm.split.hdu.edu.cn/showproblem.php?pid=5901 Description Easy question! C ...

  6. hdu 3336 Count the string -KMP&dp

    It is well known that AekdyCoin is good at string problems as well as number theory problems. When g ...

  7. HDU 6470 Count 【矩阵快速幂】(广东工业大学第十四届程序设计竞赛 )

    题目传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6470 Count Time Limit: 6000/3000 MS (Java/Others)    ...

  8. HDU 1811 Rank of Tetris(并查集按秩合并+拓扑排序)

    Rank of Tetris Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) T ...

  9. HDU 4372 Count the Buildings

    Count the Buildings Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Othe ...

随机推荐

  1. POJ1056 IMMEDIATE DECODABILITY【数据结构】

    题目地址:http://poj.org/problem?id=1056 Description An encoding of a set of symbols is said to be immedi ...

  2. WP开发笔记——程序的退出方法

    Windows Phone程序中,并没有之前的类似于“App.Exit()”之类的函数用来让你退出程序.这是怎么回事儿呢? 很简单,在Windows Phone 7中系统要求配备了硬件的“Back”键 ...

  3. 我的总结SVN的使用

    SVN平时在用时,一般要做到早上一次更新,中间每做出一个模块就要提交,就是一次更新,多次提交, SVN在修改公共类,配置文件时一定要注意,如果修改的是配置文件中的东西,这样修改完之后一定要提交, 如果 ...

  4. PHP获取当前日期或指定日期的所在月的第一天和最后一天

    <?php function getthemonth($date) { $firstday = date('Y-m-01', strtotime($date)); $lastday = date ...

  5. 下拉刷新--第三方开源--PullToRefresh

    效果预览图: 下载地址:https://github.com/chrisbanes/Android-PullToRefresh activity_main.xml: <RelativeLayou ...

  6. Spark菜鸟学习营Day6 分布式代码运行调试

    Spark菜鸟学习营Day6 分布式代码运行调试 作为代码调试,一般会分成两个部分 语法调试,也就是确定能够运行 结果调试,也就是确定程序逻辑的正确 其实这个都离不开运行,所以我们说一下如何让开发的S ...

  7. openerp经典收藏 对象的预定义方法(转载)

    对象的预定义方法 原文:http://shine-it.net/index.php/topic,2159.15.html 每个OpenERP的对象都有一些预定义方法,这些方法定义在基类osv.osv中 ...

  8. mac常用设置

    1.修改mac主机名 系统偏好设置->共享->电脑名称 ,编辑就可以了. sudo scutil --set HostName hostname 这个是修改主机名 sudo scutil ...

  9. MVC 5.0(or5.0↓) Ajax.BeginForm 异步上传附件问题,答案是不能的!

    MVC 5.0(or5.0↓)  Ajax.BeginForm 异步上传附件问题,答案是不能的! (请注意我这里说的异步!) 来看一下下面这段一步提交file的代码 //前台 .cshtml 文件 & ...

  10. apache配置VirtualHost(windows)

    以下方式适合原生 Apache, XAMPP 和WAMP 套件. 1. 打开目录 {Apache2 安装目录}\conf\extra\, 找到 httpd-vhosts.conf 文件. 2. 仿照例 ...