题目链接:

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.

题意

给这么多时间点,这些时间点是interesting的点,如果连续15分钟不出现interesting的点的话,就要换了;问最长能看多上时间;

思路

那就看相邻的点的间隔是不是长于15了,还有就是这个节目一共长90分钟;

AC代码

#include <bits/stdc++.h>
using namespace std;
#define Riep(n) for(int i=1;i<=n;i++)
#define Riop(n) for(int i=0;i<n;i++)
#define Rjep(n) for(int j=1;j<=n;j++)
#define Rjop(n) for(int j=0;j<n;j++)
#define mst(ss,b) memset(ss,b,sizeof(ss));
typedef long long LL;
const LL mod=1e9+;
const double PI=acos(-1.0);
const int inf=0x3f3f3f3f;
const int N=1e5+;
int n,a[];
int main()
{
scanf("%d",&n);
for(int i=;i<=n;i++)
{
scanf("%d",&a[i]);
}
a[]=;
for(int i=;i<=n;i++)
{
if(a[i]-a[i-]>)
{
cout<<a[i-]+<<endl;
return ;
}
}
cout<<min(,a[n]+)<<endl; return ;
}

最新文章

  1. xxx.app已损坏,打不开.你应该将它移到废纸篓 macOS 10.12 Sierra
  2. ActiveMQ跑起来
  3. Sql统计一个字符串在另一个字符串出现的次数的函数-fnQueryCharCountFromString
  4. BFS(双向) HDOJ 3085 Nightmare Ⅱ
  5. 创意设计展示:折叠效果在移动 App 中的应用
  6. linux强制用户下线
  7. phpcms下载下来的程序刚安装就报错了
  8. (03)odoo模型/记录集/公用操作
  9. 虚拟化技术性能总结:Zones, KVM, Xen
  10. php 大数组的POST问题解决
  11. spring boot / cloud (十五) 分布式调度中心进阶
  12. TCP/IP协议栈 ARP和RARP协议
  13. Linux安装mongodb总结
  14. spring依赖注入之构造函数注入,set方法注入
  15. Mysql 创建及导入表
  16. Vue keep-alive如何实现只缓存部分页面
  17. Ubuntu 修改sudoers之后无法用sudo怎么恢复
  18. Linux 查看网络状态工具
  19. 彻底地/ 终于地, 解决 关于apache 权限的问题了:: 修改 DocumentRoot后的 403错误: have no permission to access / on this server
  20. 一步一步学android之控件篇——ListView基本使用

热门文章

  1. MBP清除NVRAM和PRAM
  2. Struts2 文件上传和下载
  3. 树莓派静态IP配置
  4. 【mac】显示隐藏文件夹
  5. BUPT复试专题—哈夫曼编码(2009)
  6. 基于源码学习-fighting
  7. [Cypress] install, configure, and script Cypress for JavaScript web applications -- part1
  8. [CSS3] Identify Interactive HTML Elements with CSS Link Pseudo Classes
  9. C/C++知识要点2——STL中Vector、Map、Set容器的实现原理
  10. Java并发编程(三)volatile域