Codeforces1141E(E题)Superhero Battle】的更多相关文章

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 …
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…
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…
链接 [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];…
当时比赛时超时了,那时没学过树状数组,也不知道啥叫离散化(貌似好像现在也不懂).百度百科--离散化,把无限空间中无限的个体映射到有限的空间中去,以此提高算法的时空效率. 这道题是dp题,离散化和树状数组用来优化,状态转移方程:dp[i][j]=sum(dp[i-1][k])----k需要满足a[j]>a[k]&&k<j; i表示所要选的个数,j表示以第a[j]个数结尾所有的符合要求的递增串的个数,最后答案就是sum(dp[n][j])--1<=j<=p;n 为要选的…
\[x*p\ge y\rightarrow x=\lfloor{{y-1}\over p}\rfloor+1\]…
[链接] 我是链接,点我呀:) [题意] 题意 [题解] 二分最后轮了几圈. 二分之后直接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…
题意: 给你一个长度为n的数组,你需要从中找一个长度为m的严格上升子序列 问你最多能找到多少个 题解: 我们先对原序列从小到大排序,排序之后的序列就是一个上升序列 这里如果两个数相等的话,那么因为题目要我们求严格上升子序列,所以我们让这个数在数组中原来位置靠后的排序之后让它靠前(靠前也就是下标小)   我们dp方程:dp[i][j]表示截至到第i(这个i是按照没排序之前的下标)个元素,上升子序列长度为j的子序列能找到dp[i][j]个 dp转移方程:dp[i][j]=dp[1--i-1][j-1…
题目: Cao Cao made up a big army and was going to invade the whole South China. Yu Zhou was worried about it. He thought the only way to beat Cao Cao is to have a spy in Cao Cao's army. But all generals and soldiers of Cao Cao were loyal, it's impossib…