cf B. Black Square】的更多相关文章

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.…
Theatre Square time limit per test 2 seconds memory limit per test 64 megabytes input standard input output standard output Theatre Square in the capital city of Berland has a rectangular shape with the size n × m meters. On the occasion of the city'…
Olya and magical square - 竞赛题解 借鉴了一下神犇tly的博客QwQ(还是打一下广告) 终于弄懂了 Codeforces 传送门 『题目』(直接上翻译了) 给一个边长为 \(2^n(n>0)\) 的正方形,你需要对它进行恰好 \(k(k>0)\) 次"剪切","剪切"的方法是:选取一个边长不为 \(1\) 的正方形,将它剪成 \(4\) 个大小相同的正方形,不能挪动位置. 要求在 \(k\) 次操作后存在一条路径:从左下角的正方…
A permutation of length n is an array containing each integer from 1 to n exactly once. For example, q = [4, 5, 1, 2, 3] is a permutation. For the permutation q the square of permutation is the permutation p that p[i] = q[q[i]] for each i = 1... n. F…
思路:这题的关键就是重复根只可能是整数. 这样先求出所有的根的数目,在减去重复的根. 代码如下: #include <iostream> #include <cstring> #include <cstdio> #include <cmath> #define ll long long using namespace std; ]; int main(){ ll n,m; scanf("%I64d%I64d",&n,&m)…
挺简单的一道题,但是做的时候没想好就开始写代码了,导致迷之WA,还是要多练习啊. #include <iostream> #include <cstdio> #include <algorithm> #include <queue> #include <set> #define LL long long int using namespace std; LL Map[][]; int main() { cin.sync_with_stdio(fa…
A. Theatre Square Theatre Square in the capital city of Berland has a rectangular shape with the size n × m meters. On the occasion of the city's anniversary, a decision was taken to pave the Square with square granite flagstones. Each flagstone is o…
CF Round #524 Div.2 - 竞赛题解 不容易CF有一场下午的比赛,开心的和一个神犇一起报了名 被虐爆--前两题水过去,第三题卡了好久,第四题毫无头绪QwQ Codeforces 传送门 Tab, 先写了ABC题,后面的之后再补 QwQ 『解析』 A-Petya and Origami 读懂题意就会做--根据题意可以求出3种"sheet"各自需要的数量,然后每一种的数量除以k向上取整后求和就是答案. B-Margarite and the best present 简单的…
2018/5/6 Codeforces Round #478 (Div. 2) C http://codeforces.com/contest/975/problem/C Valhalla Siege 题意:n的士兵,每个士兵有一些生命值,有q次询问,每次询问从前向后造成ki点贯穿伤害(生命值归零的士兵死去,后续士兵承受溢出伤害),问每次询问有几个士兵还活着.当所有士兵死去时,不继续造成溢出伤害并且所有士兵复活. 思路:二分搜索,对士兵生命值求前缀和,每次询问造成的伤害累计,记为s,用upper…
C. Color Stripe time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A colored stripe is represented by a horizontal row of n square cells, each cell is pained one of k colors. Your task is to…