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 ;
}

Codeforces Round #351 (VK Cup 2016 Round 3, Div. 2 Edition) A的更多相关文章

  1. Codeforces Round #351 (VK Cup 2016 Round 3, Div. 2 Edition) B. Problems for Round 水题

    B. Problems for Round 题目连接: http://www.codeforces.com/contest/673/problem/B Description There are n ...

  2. Codeforces Round #351 (VK Cup 2016 Round 3, Div. 2 Edition) B

    B. Problems for Round time limit per test 2 seconds memory limit per test 256 megabytes input standa ...

  3. Codeforces Round #351 (VK Cup 2016 Round 3, Div. 2 Edition)只有A题和B题

    连接在这里,->点击<- A. Bear and Game time limit per test 2 seconds memory limit per test 256 megabyte ...

  4. Codeforces Round #351 (VK Cup 2016 Round 3, Div. 2 Edition) D Bear and Two Paths

    题目链接: http://codeforces.com/contest/673/problem/D 题意: 给四个不同点a,b,c,d,求是否能构造出两条哈密顿通路,一条a到b,一条c到d. 题解: ...

  5. Codeforces Round #351 (VK Cup 2016 Round 3, Div. 2 Edition) C - Bear and Colors

    题目链接: http://codeforces.com/contest/673/problem/C 题解: 枚举所有的区间,维护一下每种颜色出现的次数,记录一下出现最多且最小的就可以了. 暴力n*n. ...

  6. Codeforces Round #351 (VK Cup 2016 Round 3, Div. 2 Edition) D. Bear and Two Paths 构造

    D. Bear and Two Paths 题目连接: http://www.codeforces.com/contest/673/problem/D Description Bearland has ...

  7. Codeforces Round #351 (VK Cup 2016 Round 3, Div. 2 Edition) C. Bear and Colors 暴力

    C. Bear and Colors 题目连接: http://www.codeforces.com/contest/673/problem/C Description Bear Limak has ...

  8. Codeforces Round #351 (VK Cup 2016 Round 3, Div. 2 Edition) A. Bear and Game 水题

    A. Bear and Game 题目连接: http://www.codeforces.com/contest/673/problem/A Description Bear Limak likes ...

  9. Codeforces Round #351 (VK Cup 2016 Round 3, Div. 2 Edition)

    A.暴力枚举,注意游戏最长为90分钟 B.暴力,c[l]++,c[r]--,记录中间有多长的段是大小为n的,注意特判m=0的情况 C.暴力枚举,我居然一开始没想出来!我一直以为每次都要统计最大的,就要 ...

  10. Codeforces Round #351 (VK Cup 2016 Round 3, Div. 2 Edition) D

    D. Bear and Two Paths time limit per test 2 seconds memory limit per test 256 megabytes input standa ...

随机推荐

  1. flask迁移

    from flask_script import Managerfrom flask_migrate import Migrate, MigrateCommandfrom info import cr ...

  2. ABAP CDS ON HANA-(5)テーブル結合ビュー

    JOINs in CDS View In ABAP CDS, Join between two data sources is allowed. Allowed joins are:- Inner J ...

  3. fiddler手机抓包配置方法

    一.下载工具包 百度搜索”fiddler 下载“ ,安装最新版本 下载的软件安装包为“fiddler_4.6.20171.26113_setup.exe”格式,双击安装.安装成功,在“开始”-“所有程 ...

  4. 数据库 MySQL part1

    数据库介绍 数据库(database,DB)是指长期存储在计算机内的,有组织,可共享的数据的集合.数据库中的数据按一定的数学模型组织.描述和存储,具有较小的冗余,较高的数据独立性和易扩展性,并可为各种 ...

  5. PHP.42-TP框架商城应用实例-后台17-商品属性3-商品分类的修改与删除

    商品分类的修改 1.改表单Goods/edit.html,加下拉框 2.因为商品属性修改涉及商品属性表goods_attr{id,attr_value,attr_id,goods_id}与属性表att ...

  6. 再谈js传值和传址

    js的传值和传址还是真绕,前回文说道 1.值类型是传值的 2.对象和数组是传址的 这两点通过例子的到了证实 然而还有一种情况没有讨论 即 函数的参数的传值和传址 通过实验,在函数中用一个新对象去覆盖传 ...

  7. Sql Server 2008 R2数据库中插入中文变成了问号

            通过Insert语句插入数据库中,结果中文都变成了乱码.原因是在数据库中有一个属性需要设置,可以通过Sql server manager studio来进行设置,也要可以通过代码来设置 ...

  8. Java笔试题-线程编程方面

      Ja 线程编程方面 60.java中有几种方法可以实现一个线程?用什么关键字修饰同步方法?stop()和suspend()方法为何不推荐使用? 答:有两种实现方法,分别是继承Thread类与实现R ...

  9. appium + Python + iOS 滑屏方法(appium版本大于1.5)

    之前一直在搞android的自动化,滑动操作一直都用swipe(),比如: he1 = int(dr.get_window_size()['height'] * 0.8)he2 = int(dr.ge ...

  10. Leetcode 686.重复叠加字符串匹配

    重复叠加字符串匹配 给定两个字符串 A 和 B, 寻找重复叠加字符串A的最小次数,使得字符串B成为叠加后的字符串A的子串,如果不存在则返回 -1. 举个例子,A = "abcd", ...