[Codeforces Round #351 Div. 2] 673A Bear and Game
2 seconds
256 megabytes
standard input
standard output
Bear Limak likes watching sports on TV. He is going to watch a game today. The game lasts 90 minutes and there are no breaks.
Each minute can be either interesting or boring. If 15 consecutive minutes are boring then Limak immediately turns TV off.
You know that there will be n interesting minutes t1, t2, ..., tn. Your task is to calculate for how many minutes Limak will watch the game.
The first line of the input contains one integer n (1 ≤ n ≤ 90) — the number of interesting minutes.
The second line contains n integers t1, t2, ..., tn (1 ≤ t1 < t2 < ... tn ≤ 90), given in the increasing order.
Print the number of minutes Limak will watch the game.
3
7 20 88
35
9
16 20 30 40 50 60 70 80 90
15
9
15 20 30 40 50 60 70 80 90
90
In the first sample, minutes 21, 22, ..., 35 are all boring and thus Limak will turn TV off immediately after the 35-th minute. So, he would watch the game for 35 minutes.
In the second sample, the first 15 minutes are boring.
In the third sample, there are no consecutive 15 boring minutes. So, Limak will watch the whole game.
我只能说刷水题异常带感。
/**/
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
int last=,x,n;
int main(){
scanf("%d",&n);
while(n--){
scanf("%d",&x);
if(x-last>){
printf("%d\n",last+);
break;
}
if(!n){
printf("%d\n",min(x+,));
break;
}
last=x;
}
return ;
}
最新文章
- hibernate+mysql的连接池配置
- PHPMailer <; 5.2.18 - RCE EXP(Bash)
- 归档—监控ORACLE数据库告警日志
- php发送post请求到nodejs服务器
- LeetCode题目分类
- RegExp子模式- ";()";
- 半透命opacity:(0-1),对于IE6版本不支持需要用filter:alpha(opacity=0-100)
- Jmeter之性能测试插件PerfMon Metrics Collector监听器,实时监听服务器资源(十四)
- clique
- Python中如何自定义一个计时器
- window 8.1 + python 3.6 + chrome 59 + selenium 3.4 环境配置
- Android Studio配置统一管理依赖版本号引用
- AI-2.梯度下降算法
- linux终端文本编辑神器vi的使用
- SQL 自定义存储过程报错
- 使用mockserver来进行http接口mock
- cocos2d-js Shader系列3:多重纹理 multiple textures multiple samplers
- vs2017 编译JRTPLIB
- android 用命令行打包生成 apk
- 常见的Shell