博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[Codeforces Round #351 Div. 2] 673A Bear and Game
阅读量:7026 次
发布时间:2019-06-28

本文共 1859 字,大约阅读时间需要 6 分钟。

 

A. Bear and Game
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
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.

Input

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.

Output

Print the number of minutes Limak will watch the game.

Examples
Input
3 7 20 88
Output
35
Input
9 16 20 30 40 50 60 70 80 90
Output
15
Input
9 15 20 30 40 50 60 70 80 90
Output
90
Note

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.

 

我只能说刷水题异常带感。

 

1 /**/ 2 #include
3 #include
4 #include
5 #include
6 #include
7 using namespace std; 8 int last=0,x,n; 9 int main(){10 scanf("%d",&n);11 while(n--){12 scanf("%d",&x);13 if(x-last>15){14 printf("%d\n",last+15);15 break;16 }17 if(!n){18 printf("%d\n",min(x+15,90));19 break;20 }21 last=x;22 }23 return 0;24 }

 

转载于:https://www.cnblogs.com/SilverNebula/p/5823501.html

你可能感兴趣的文章
漏桶算法 Leaky Bucket (令牌桶算法 Token Bucket)学习笔记
查看>>
ext struts2 上传细节
查看>>
Linux shell getopts 学习
查看>>
容易忘记的linux命令之chattr lsattr 设置隐藏权限与特殊权限的设置
查看>>
我的友情链接
查看>>
js动态增加删除ul节点li
查看>>
[Thinking in Java]之控制执行(Controling Execution)(三)
查看>>
mysql数据库详解
查看>>
keepalived(续一)
查看>>
nagios
查看>>
C++可变参数模板(variadic template)详细介绍及代码举例
查看>>
CentOS 7.4 Tengine安装配置详解(六)
查看>>
高性能WEB开发应用指南
查看>>
根据从数据库中获取到的值控制按钮被选中
查看>>
接口要怎么对?你知道正确的姿势吗
查看>>
配置mysql数据库集群
查看>>
TensorFlow分布式实践
查看>>
缺失值及处理
查看>>
我的友情链接
查看>>
msyql root无权限登录
查看>>