CF673A.Bear and Game

入门

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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 _t_1, _t_2, ..., t__n. Your task is to calculate for how many minutes Limak will watch the game.

熊 Limak 喜欢在电视上观看体育比赛。他今天将观看一场比赛。比赛持续 90 分钟,且中间没有休息。

每一分钟要么是“有趣的”,要么是“无聊的”。如果连续出现 15 分钟“无聊”的情况,则 Limak 会立即关闭电视。

已知比赛中将有 nn 个“有趣的”分钟,其时间点分别为 t1, t2, ..., tnt_1,\,t_2,\,...,\,t_n。你的任务是计算 Limak 将观看比赛多少分钟。

输入格式

The first line of the input contains one integer n (1 ≤ n ≤ 90) — the number of interesting minutes.

The second line contains n integers _t_1, _t_2, ..., t__n (1 ≤ _t_1 < _t_2 < ... t__n ≤ 90), given in the increasing order.

输入的第一行包含一个整数 nn(1≤n≤901 \leq n \leq 90)—— 表示有趣分钟的数量。

第二行包含 nn 个整数 t1, t2, ..., tnt_1,\ t_2,\ ..., \ t_n(1≤t1<t2<...<tn≤901 \leq t_1 < t_2 < ... < t_n \leq 90),以递增顺序给出。

输出格式

Print the number of minutes Limak will watch the game.

输出Limak观看比赛的分钟数。

输入输出样例

  • 输入#1

    3
    7 20 88

    输出#1

    35
  • 输入#2

    9
    16 20 30 40 50 60 70 80 90

    输出#2

    15
  • 输入#3

    9
    15 20 30 40 50 60 70 80 90

    输出#3

    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.

在第一个样例中,第 21、22、…、35 分钟均为无聊时间,因此 Limak 将在第 35 分钟结束后立即关闭电视。他将观看比赛 35 分钟。

在第二个样例中,前 15 分钟均为无聊时间。

在第三个样例中,不存在连续的 15 分钟无聊时间。因此,Limak 将观看整场比赛。

输入解题思路,AI测评打分。不知道怎么写?

首页