---恢复内容开始---

###题意:
有n个犯人,手上都有个长度为Li的武器,当铃响时大家同时挥动武器,只能把前面攻击范围内的敌人杀死,问最后还剩几个人。
![](https://images2018.cnblogs.com/blog/1342501/201807/1342501-20180727200740562-1624391818.png)
###题目传送门:
[http://codeforces.com/contest/892/problem/B]
###思路:
从后面遍历能杀的人,一个一个杀,更新当前能杀的最大人数,用sum统计,最后输出n-sum即可。
###代码:
```
#include
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n,i;
int a[1000005];
while(cin>>n){
for(i=1;i>a[i];
int sum=0,can=a[n];
for(i=n-1;i>0;i--){
if(can)
sum++;
can--;
can=max(can,a[i]);
}
cout

CF892.B. Wrath的更多相关文章

  1. Codeforces Round #446 (Div. 2) B. Wrath【模拟/贪心】

    B. Wrath time limit per test 2 seconds memory limit per test 256 megabytes input standard input outp ...

  2. Seven Deadly Sins: Gluttony, Greed, Sloth, Wrath, Pride, Lust, and Envy.

    Seven Deadly Sins: Gluttony, Greed, Sloth, Wrath, Pride, Lust, and Envy.七宗罪:暴食.贪婪.懒惰.暴怒.傲慢.色欲.妒忌.

  3. Codeforces 892 B.Wrath

    B. Wrath time limit per test 2 seconds memory limit per test 256 megabytes input standard input outp ...

  4. codeforces #446 892A Greed 892B Wrath 892C Pride 891B Gluttony

    A  链接:http://codeforces.com/problemset/problem/892/A 签到 #include <iostream> #include <algor ...

  5. CF892/problem/C

    题目传送门: [http://codeforces.com/contest/892/problem/C] 题意: 给你一个长度为n的数组,相邻两个元素的GCD(最大公约数)可以取代二者的任意一个,问你 ...

  6. 【Codeforces Round #446 (Div. 2) B】Wrath

    [链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 倒着来,维护一个最小的点就可以了. [代码] #include <bits/stdc++.h> using namesp ...

  7. 892B. Wrath#愤怒的连环杀人事件(cin/cout的加速)

    题目出处:http://codeforces.com/problemset/problem/892/B 题目大意:一队人同时举刀捅死前面一些人后还活着几个 #include<iostream&g ...

  8. jQuery Mobile入门

    转:http://www.cnblogs.com/linjiqin/archive/2011/07/17/2108896.html 简介:jQuery Mobile框架可以轻松的帮助我们实现非常好看的 ...

  9. Bible

    001 Love your neighbor as yourself.         要爱人如己.--<旧·利>19:18      002 Resentment kills a foo ...

随机推荐

  1. JS学习之路之JavaScript match() 方法

    match() 方法,在字符串内找到相应的值并返回这些值,()内匹配字符串或者正则表达式. 该方法类似 indexOf() 和 lastIndexOf(),但是它返回指定的值,而不是字符串的位置. d ...

  2. django安装与使用

    django安装与使用 --更新中 安装 我这里采用pip安装 pip install django 创建django工程 创建好的工程,会在当前目录.下 django-admin startproj ...

  3. OpenCvSharp尝试

    OpenCvSharp是封装了OpenCV的.net版本 项目地址:https://github.com/shimat/opencvsharp 简单使用: 1.NuGet安装 2.使用OpenCvSh ...

  4. Lua无法排序的问题(Key需要是连续的)

    排序的Key需要是连续的 local x = {[1]={x=6}, [2]={x=5}, [3]={x=7}, [5]={x=2}, [6]={x=8}, [7]={x=5}} ---从小到大排序 ...

  5. TP中的图片水印

    $img_dir = ROOT_PATH . 'public/upload/card/' . $data['jt_id']; //创建合成图片存放位置 //自动创建文件夹 if (!file_exis ...

  6. puppet使用 apache passsenger 作为前端 (centos)

    目录 1. 概要 2. nginx + passenger 配置 2.1. package 安装 2.2. 配置文件设置 2.3. rack 目录生成 概要 使用 nginx + passenger ...

  7. Metasploit渗透测试实际应用

    Metasploit:如何在 Metasploit 中使用反弹 Shell https://xz.aliyun.com/t/2380 Metasploit:如何使用 msfvenom https:// ...

  8. MySQL 目录结构、配置文件、修改密码

    查看全局数据文件路径 show global variables like "%datadir%" 一.文件目录结构 文件安装路径为F:/JJ/MYSQL-5.6.42-WINX6 ...

  9. 从Hadoop到Spark的架构实践

    当下,Spark已经在国内得到了广泛的认可和支持:2014年,Spark Summit China在北京召开,场面火爆:同年,Spark Meetup在北京.上海.深圳和杭州四个城市举办,其中仅北京就 ...

  10. Ubuntu下导入PySpark到Shell和Pycharm中(未整理)

    实习后面需要用到spark,虽然之前跟了edX的spark的课程以及用spark进行machine learning,但那个环境是官方已经搭建好的,但要在自己的系统里将PySpark导入shell(或 ...