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.

题意:n个有趣时间点 当持续15分钟没有遇到有趣时间点 则截至  输出持续的总时间

题解:记录有趣时间点  for循环寻找 截至点并且输出   未找到则输出90

 #include<bits/stdc++.h>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<queue>
#include<stack>
#include<map>
#define ll __int64
#define pi acos(-1.0)
using namespace std;
int n;
map<int,int> mp;
int exm;
int ans;
int main()
{
int n;
scanf("%d",&n);
mp.clear();
for(int i=;i<=n;i++)
{
scanf("%d",&exm);
mp[exm]=;
}
int gg=;
ans=;
for(int i=;i<=;i++)
{
if(mp[i])
gg=i;
if(i-gg>)
{
ans=i;
break;
}
}
if(ans==)
cout<<""<<endl;
else
cout<<ans<<endl;
return ;
}

最新文章

  1. (转)SVN服务器搭建和使用(一)
  2. zlog学习笔记(level)
  3. VMware安装的相关文章
  4. Oracle 建表,递增序列,触发器,分析函数row_number() ,partition by 子句。
  5. Beeline known issues
  6. jquery.validate+jquery.form提交的三种方式
  7. BMap介绍
  8. mysql中的第三范式
  9. libeXosip2(1) -- Modules
  10. 0603 python 基础02
  11. KestrelServer
  12. Springmvc @CookieValue实用
  13. EventBus通信小能手
  14. Windows 环境下的 protoc 安装(转)
  15. RAC集群安装校验输出信息
  16. Convolutional Restricted Boltzmann Machines
  17. leetcode笔记:Bulls and Cows
  18. Java-小技巧-002-String 转 long
  19. chrome浏览器本地文件支持ajax请求的解决方法
  20. Flowable BPMN 简单使用

热门文章

  1. [BZOJ1455]罗马游戏(左偏树)
  2. 标记编码报错ValueError: bad input shape ()
  3. mysql学习第三天练习(多表连接)
  4. maven之package与install的区别
  5. Android TextView 单行文本的坑
  6. javac、jar使用实录
  7. Ubuntu下使用Git_6
  8. Python 3基础教程27-字典
  9. SPFA模板 Bellmanford优化版
  10. Python 进阶(一些进阶技巧)