Codeforces Round #351 (VK Cup 2016 Round 3, Div. 2 Edition) A
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.
题意: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 ;
}
最新文章
- (转)SVN服务器搭建和使用(一)
- zlog学习笔记(level)
- VMware安装的相关文章
- Oracle 建表,递增序列,触发器,分析函数row_number() ,partition by 子句。
- Beeline known issues
- jquery.validate+jquery.form提交的三种方式
- BMap介绍
- mysql中的第三范式
- libeXosip2(1) -- Modules
- 0603 python 基础02
- KestrelServer
- Springmvc @CookieValue实用
- EventBus通信小能手
- Windows 环境下的 protoc 安装(转)
- RAC集群安装校验输出信息
- Convolutional Restricted Boltzmann Machines
- leetcode笔记:Bulls and Cows
- Java-小技巧-002-String 转 long
- chrome浏览器本地文件支持ajax请求的解决方法
- Flowable BPMN 简单使用