hdu 1802 Black and white painting(置换群)

题目链接:hdu 1802 Black and white painting

题意:

有一个n*n的格子,然后用c种颜色去涂,问你有多少种方案。

能旋转,反射的算一种方案。

题解:

polya定理的经典运用

旋转只有 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

代码就不贴了,用的大数模板。

时间: 2024-10-23 16:51:10

hdu 1802 Black and white painting(置换群)的相关文章

hust 1546 && hdu 3911 Black And White

题目描述 There are a bunch of stones on the beach; Stone color is white or black. Little Sheep has a magic brush, she can change the color of a continuous stone, black to white, white to black. Little Sheep like black very much, so she want to know the l

sdutoj 2373 Black and white painting( 规律统计计算 3Y )

Black and white painting 题目描述 You are visiting the Centre Pompidou which contains a lot of modern paintings. In particular you notice one painting which consists solely of black and white squares, arranged in rows and columns like in a chess board (n

HDU 3911 Black And White 分段树 题解

Problem Description There are a bunch of stones on the beach; Stone color is white or black. Little Sheep has a magic brush, she can change the color of a continuous stone, black to white, white to black. Little Sheep like black very much, so she wan

hdu 3911 Black And White(线段树)

题目连接:hdu 3911 Black And White 题目大意:给定一个序列,然后有M次操作: 0 l r:表示询问l,r中最大连续1的个数 1 l r:表示将l,r区间上的数取反 解题思路:线段树的一种题型,区间合并,因为有一个取反的操作,所以对于每个节点要维护6个值,包括连续0,1最长序列的长度,左边和右边的最长连续长度.需要注意的是,如果询问的区间最大值是从R[lson] + L[rson]来到,要判断是否比长度大于r - l + 1.一开始没注意,所以WA了,上网搜了下别人的题解,

HDU 5113 Black And White(DFS+剪枝)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5113 题面: Black And White Time Limit: 2000/2000 MS (Java/Others)    Memory Limit: 512000/512000 K (Java/Others) Total Submission(s): 1336    Accepted Submission(s): 350 Special Judge Problem Description I

HDU 3911 Black And White

Black And White Time Limit: 3000ms Memory Limit: 32768KB This problem will be judged on HDU. Original ID: 391164-bit integer IO format: %I64d      Java class name: Main There are a bunch of stones on the beach; Stone color is white or black. Little S

HDU 3911 Black And White(线段树区间合并)

Problem Description There are a bunch of stones on the beach; Stone color is white or black. Little Sheep has a magic brush, she can change the color of a continuous stone, black to white, white to black. Little Sheep like black very much, so she wan

hdu 5113 Black And White (dfs回溯+剪枝)

Black And White Time Limit: 2000/2000 MS (Java/Others)    Memory Limit: 512000/512000 K (Java/Others) Total Submission(s): 854    Accepted Submission(s): 218 Special Judge Problem Description In mathematics, the four color theorem, or the four color

[HDU 5113] Black And White (dfs+剪枝)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5113 题目大意:给你N*M的棋盘,K种颜色,每种颜色有c[i]个(sigma(c[i]) = N*M),现在给棋盘染色,使得相邻的两个棋盘染成不同的颜色,并且把所有颜色用完. 因为棋盘最大为5*5的,因此可以考虑搜索+剪枝. 从左到右,从上到下看当前格子能够染成什么颜色. 有一个限制性条件,就是说如果当前棋盘的格子数量的一半小于一种颜色的数量时,那么就一定有两个相邻的棋盘被染成了相同的颜色. 因为假