题目链接:

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

codeforces 673A A. Bear and Game(水题)的更多相关文章

  1. Educational Codeforces Round 7 B. The Time 水题

    B. The Time 题目连接: http://www.codeforces.com/contest/622/problem/B Description You are given the curr ...

  2. Educational Codeforces Round 7 A. Infinite Sequence 水题

    A. Infinite Sequence 题目连接: http://www.codeforces.com/contest/622/problem/A Description Consider the ...

  3. Codeforces Testing Round #12 A. Divisibility 水题

    A. Divisibility Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/597/probl ...

  4. Codeforces Beta Round #37 A. Towers 水题

    A. Towers 题目连接: http://www.codeforces.com/contest/37/problem/A Description Little Vasya has received ...

  5. codeforces 677A A. Vanya and Fence(水题)

    题目链接: A. Vanya and Fence time limit per test 1 second memory limit per test 256 megabytes input stan ...

  6. CodeForces 690C1 Brain Network (easy) (水题,判断树)

    题意:给定 n 条边,判断是不是树. 析:水题,判断是不是树,首先是有没有环,这个可以用并查集来判断,然后就是边数等于顶点数减1. 代码如下: #include <bits/stdc++.h&g ...

  7. Codeforces - 1194B - Yet Another Crosses Problem - 水题

    https://codeforc.es/contest/1194/problem/B 好像也没什么思维,就是一个水题,不过蛮有趣的.意思是找缺黑色最少的行列十字.用O(n)的空间预处理掉一维,然后用O ...

  8. Codeforces Round #318 [RussianCodeCup Thanks-Round] (Div. 1) B. Bear and Blocks 水题

    B. Bear and Blocks Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/573/pr ...

  9. 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 ...

随机推荐

  1. R语言入门--画图(一)--ggplot2

    先写一些需要用到的知识点,比如包.函数 dplyr 很好用的包 经常与ggplot2连用 mutate:用于对数据框的列进行重新处理,或者用处理的结果添加新列 数据清洗: 1.na.omit()   ...

  2. Scrapy学习-5-下载图片实例

    1. 在项目下创建一个images文件用于存放图片 2. 载图片相关模块 pip install pillow 3.修改配置文件,激活pipelines ITEM_PIPELINES = { 'Art ...

  3. [转]JVM 堆内存设置原理

    堆内存设置 原理 JVM堆内存分为2块:Permanent Space 和 Heap Space. Permanent 即 持久代(Permanent Generation),主要存放的是Java类定 ...

  4. Croc Champ 2013 - Round 2 C. Cube Problem

    问满足a^3 + b^3 + c^3 + n = (a+b+c)^3 的 (a,b,c)的个数 可化简为 n = 3*(a + b) (a + c) (b + c) 于是 n / 3 = (a + b ...

  5. 数据结构之区间K大数

    求区间的问题有很多类,虽然前人有很多讲解了: 但是我在这里在普及一下,算是自己的一种复习吧. 1.静态询问一个区间的的第k大数,比如询问[l,r] k大数.虽然主席树可以处理,但是这类问题应该是划分树 ...

  6. Oracle ORA-01033: ORACLE initialization or shutdown in progress

    先说明,我出现此错误的原因是:我手动通过drop语句删除表空间,结果磁盘中文件还存在,然后我手动删除了文件,重启了oracle服务,再去连接oracle时就出现了这个错误. 网上也有“连接Oracle ...

  7. amplab

    https://github.com/amplab/SparkNet https://amplab.cs.berkeley.edu/

  8. 加密算法和MD5等散列算法的区别(转)

    本文转自http://www.cnblogs.com/eternalwt/archive/2013/03/21/2973807.html 感谢作者 1.在软件开发的用户注册功能中常出现MD5加密这个概 ...

  9. android 计时器

    <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=&quo ...

  10. 关于android分享(sharedsdk的简单使用)

    老早就使用了.可是如今才写,惰性太大,如今改 如今做产品的话相信大家基本都做分享吧.一个是项目的需求须要,另一个是能够非常好的宣传自己的产品.其它的优点依据情况而论 事实上每一个平台都有它自己的文档, ...