CF1080D Olya and magical square】的更多相关文章

思路: 构造. 实现: #include <bits/stdc++.h> using namespace std; typedef long long ll; ll sum[]; int main() { ; ; i <= ; i++) { sum[i] = (sum[i - ] + (1ll << cnt)); cnt += ; } int t; ll n, k; cin >> t; while (t--) { cin >> n >> k…
Olya and magical square - 竞赛题解 借鉴了一下神犇tly的博客QwQ(还是打一下广告) 终于弄懂了 Codeforces 传送门 『题目』(直接上翻译了) 给一个边长为 \(2^n(n>0)\) 的正方形,你需要对它进行恰好 \(k(k>0)\) 次"剪切","剪切"的方法是:选取一个边长不为 \(1\) 的正方形,将它剪成 \(4\) 个大小相同的正方形,不能挪动位置. 要求在 \(k\) 次操作后存在一条路径:从左下角的正方…
D. Olya and magical square 题目链接:https://codeforces.com/contest/1080/problem/D 题意: 给出一个边长为2n的正方形,每次可以将其划分,要求划分出来从左下角到右上角沿着左边和上边的边走的路径的小正方形边长相等.现在有k个划分的机会,问是否能把k次机会用完(当边长为1时则不能划分了),如果可以,输出路径上的小正方形的边长长度. 题解: 这题看题解看了半天,最终应该说是搞懂了... 首先,划分思路是这样的,先划分一下成四块,然…
题目大意: t 个测试用例  (1≤t≤103) 给定n k  (1≤n≤10^9,1≤k≤10^18) 表示有一个边长为2^n的正方形格子 每次操作只能将一个格子切割为左上左下右上右下的四等分格子 问进行k次四等分切割后 能否使得 左下角的格子的边长 和 右上角的格子的边长 相等 并且存在一条左下角格子到右上角格子的路径上 经过的格子的边长 也和它们相等 若可以输出 “YES 切割后的log2(边长)” 若操作次数用不完输出“NO” 首先 对边长为2^1的格子四等分切割为1*1小格需要    …
A. Petya and Origami Water. #include <bits/stdc++.h> using namespace std; #define ll long long ll n, k; ll Get(ll x) { ? (x * n) / k : (x * n) / k + ; } int main() { while (scanf("%lld%lld", &n, &k) != EOF) { ll res = Get() + Get()…
A. Petya and Origami time limit per test  1 second   memory limit per test  256 megabytes input standard input output standard output Petya is having a party soon, and he has decided to invite his nn friends. He wants to make invitations in the form…
CF Round #524 Div.2 - 竞赛题解 不容易CF有一场下午的比赛,开心的和一个神犇一起报了名 被虐爆--前两题水过去,第三题卡了好久,第四题毫无头绪QwQ Codeforces 传送门 Tab, 先写了ABC题,后面的之后再补 QwQ 『解析』 A-Petya and Origami 读懂题意就会做--根据题意可以求出3种"sheet"各自需要的数量,然后每一种的数量除以k向上取整后求和就是答案. B-Margarite and the best present 简单的…
C. Magical Boxes Emuskald is a well-known illusionist. One of his trademark tricks involves a set of magical boxes. The essence of the trick is in packing the boxes inside other boxes. From the top view each magical box looks like a square with side…
Remember the story of Little Match Girl? By now, you know exactly what matchsticks the little match girl has, please find out a way you can make one square by using up all those matchsticks. You should not break any stick, but you can link them up, a…
Given a sequence of words, check whether it forms a valid word square. A sequence of words forms a valid word square if the kth row and column read the exact same string, where 0 ≤k < max(numRows, numColumns). Note: The number of words given is at le…