CF300D Painting Square】的更多相关文章

Painting Square https://codeforces.com/problemset/problem/300/D 给了一个理解起来较复杂但是本质上很简单的分形. 题解 很显然,只有边长为大于等于3且为奇数的正方形能被操作,并且每一次的操作方式是唯一的:沿中心将正方形分成四个等大的小正方形. 我们令操作次数为M,表示大小为N的正方形可以被分割缩小的次数(即每次分割一个存在的最小的正方形),\(dp_{M,K}\)表示一个操作次数为M的正方形中,操作K次的方案数. 则有: \[ dp_…
http://codeforces.com/problemset/problem/300/D 题意:每一次操作可以选一个正方形,令边长为n,如果n为奇数那么可以从中间画一个十字,分成4个大小相等的边长为(n-1)/2的正方形.给一个正方形,求操作k次后能得到的不同图案的个数 思路:令f(s,k)表示边长为s的正方形操作k次后的答案总数,则f(s,k)=∑f(s/2,k1)*f(s/2,k2)*f(s/2,k3)*f(s/2,k4),其中s为奇数,k1+k2+k3+k4=k-1,令g(s,k)=Σ…
A. Array 模拟. B. Coach 模拟. C. Beautiful Numbers good number的位和最大不超过\(10^7\),那么只要枚举a或b的个数,然后最多循环7次判断位和是否是good number. D. Painting Square 因为新划分的4个小矩形也需要为正方形,所以当前长度n必须为奇数,否则无法继续划分. \(f(i,j)\)表示长为\(2^i-1\),操作\(j\)次的方案数. 直接分成4部分比较难,所以可以先考虑分成左右两部分,左右两部分继续考虑…
Vasya works as a watchman in the gallery. Unfortunately, one of the most expensive paintings was stolen while he was on duty. He doesn't want to be fired, so he has to quickly restore the painting. He remembers some facts about it. The painting is a…
Description Nothing is more beautiful than square! So, given a grid of cells, each cell being black or white, it is reasonable to evaluate this grid’s beautifulness by the side length of its maximum continuous subsquare which fully consists of white…
题目链接: B. Restoring Painting time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vasya works as a watchman in the gallery. Unfortunately, one of the most expensive paintings was stolen while he…
题目网址:http://codeforces.com/contest/828/problem/B 题目: Polycarp has a checkered sheet of paper of size n × m. Polycarp painted some of cells with black, the others remained white. Inspired by Malevich's "Black Square", Polycarp wants to paint mini…
Codeforces 828B Black Square(简单题) Description Polycarp has a checkered sheet of paper of size n × m. Polycarp painted some of cells with black, the others remained white. Inspired by Malevich's "Black Square", Polycarp wants to paint minimum pos…
B. Black Square time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Polycarp has a checkered sheet of paper of size n × m. Polycarp painted some of cells with black, the others remained white.…
http://acm.hdu.edu.cn/showproblem.php?pid=5079 题意: n*n网格,每个格子可以涂黑色或白色,有的格子必须涂黑色 问最大白色正方形边长分别为0,1,2,……n 的涂色方案数 令ans[i]表示最大白色正方形边长小于i的方案数 最大边长=i 的就是ans[i+1]-ans[i] 枚举sz,表示现在要求最大白色正方形边长<i的方案数 设dp[i][st] 表示前i行,状态为st的方案数 st内压缩了n-sz+1个数,其中的第j个数表示 从右往左数第j列,…