CF1141E Superhero Battle】的更多相关文章

A superhero fights with a monster. The battle consists of rounds, each of which lasts exactly n minutes. After a round ends, the next round starts immediately. This is repeated over and over again. Each round has the same scenario. It is described by…
E. Superhero Battle time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A superhero fights with a monster. The battle consists of rounds, each of which lasts exactly nn minutes. After a round…
E. Superhero Battle A superhero fights with a monster. The battle consists of rounds, each of which lasts exactly …
\[x*p\ge y\rightarrow x=\lfloor{{y-1}\over p}\rfloor+1\]…
A superhero fights with a monster. The battle consists of rounds, each of which lasts exactly nn minutes. After a round ends, the next round starts immediately. This is repeated over and over again. Each round has the same scenario. It is described b…
链接 [https://codeforces.com/contest/1141/problem/E] 题意 怪物开始的生命值,然后第i分钟生命值的变化 问什么时候怪物生命值为非正 分析 有一个巨大的坑 其实是很简单的一个题 可我还是跳了进去很多次 对于超过n的特别注意就行了 算是经典贪心吧 看代码吧 代码 #include<bits/stdc++.h> using namespace std; #define ll long long const int N=2e5+10; ll d[N];…
[链接] 我是链接,点我呀:) [题意] 题意 [题解] 二分最后轮了几圈. 二分之后直接o(N)枚举具体要多少时间即可. 注意爆long long的情况. 可以用对数函数,算出来有多少个0 如果大于17直接缩小点就好. [代码] #include <bits/stdc++.h> #define ll long long using namespace std; const int N = 2e5; ll H,a[N+10]; int n; int main(){ ios::sync_with…
题意:有一个HP为\(h\)的大怪兽,你需要轮流进行\(i\)次操作.每次可以使\(h+=d_i\)(\(d_i\)有正有负),当第\(n\)次操作完成后,再从第一次开始,问能否使得怪兽的HP变为\(0\)或更低,如果可以,输出操作次数,否则输出\(-1\). 题解:我们首先求\(d\)的前缀和,如果在求的过程中就能使怪兽死掉的话,直接输出即可.然后再去判断\(pre[n]\)是否小于\(0\),如果不小于,那么我们每一个循环得到的都是正的贡献,永远也打不死怪兽!再来看.我们最后的操作次数一定是…
Codeforces Round #547 (Div. 3) 题目链接:https://codeforces.com/contest/1141 A,B咕咕了... C. Polycarp Restores Permutation 题意: 有一个n的排列,但现在只给出相邻两位的差,问原排列是多少,如果不存在就输出-1. 题解: 通过相邻两位的差我们可以知道第一个元素和其它位置元素的大小关系,然后根据这个来搞一波就行了. 代码如下: #include <bits/stdc++.h> using n…
http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n grid. In this game a ships are placed on the grid. Each of the ships consists of bconsecutive cells. No cell can be part of two ships, however, the shi…