Codeforces 892B. Wrath
来源:互联网 发布:淘宝代金卷 编辑:程序博客网 时间:2024/06/11 07:19
题目大意:几个人互相杀人,只要排在他前面而且前面那个人的下标大于等于自己的下标减去L[i]就可以杀,问最后剩多少人
#include<bits/stdc++.h>using namespace std;const int maxn=1e6+7;int num[maxn];int main(){int n;scanf("%d",&n);for(int i=1;i<=n;i++){scanf("%d",&num[i]);}int ans=0;int tmp=n+1;for(int i=n;i>=1;i--){if(i<tmp) ans++;if(tmp>=i-num[i]) tmp=i-num[i];}printf("%d\n",ans);}
阅读全文
0 0
- Codeforces 892B. Wrath
- CodeForces 892B Wrath
- codeforces-892B Wrath
- codeforces 892B. Wrath
- Codeforces 892 B. Wrath (递推)
- Codeforces 892B Wrath 【差分】
- Codeforces 892B Wrath (递推)
- Codeforces Round #446 (Div. 2) B Wrath
- Codeforces Round #446 (Div. 2) B.Wrath
- Codeforces Round #446 (Div. 2)B. Wrath
- 趣味题:杀人范围 codeforces B. Wrath
- Wrath CodeForces
- Codeforces Round #446 (Div. 2) B. Wrath (贪心)
- Codeforces-446(Div.2)-B-Wrath--(线段树区间更新)
- Codeforces Round #446 (Div. 2) B. Wrath(线段树,RMQ,区间最值)
- B. Wrath (思路题目)
- CodeForces892B Wrath
- codeforces B
- Pyhton 3 学习笔记 2017.11.18
- 3-7 类的友元函数的应用
- Java中List转换为数组,数组转List
- 平稳VAR模型一
- 写给Android开发者的混淆使用手册
- Codeforces 892B. Wrath
- 面向对象程序设计上机练习八(对象数组)
- 关于做批量重复工作的总结
- 自定义View带箭头的圆环,加速 减速 暂停 变色
- 例题8-5 Gergovia的酒交易(Wine trading in Gergovia, UVa 11054)
- C语言中,开3次方用什么?
- 洛谷P2824:[HEOI2016]排序 (二分答案+线段树)
- U盘插入电脑需要格式化,数据恢复
- java通过UUID生成16位唯一订单号