当前位置:首页 > 百科 > 正文
CF 673A - Bear and Game
来源:哔哩哔哩  时间:2023-07-07 18:44:56
字号:

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.

--------------------------------------------------

Bear Limak 喜欢看电视上的体育比赛。 他今天要去看一场比赛。 比赛持续90分钟,没有休息时间。

每一分钟都可以很有趣,也可以很无聊。 如果连续 15 分钟感到无聊,利马克就会立即关掉电视。

你知道会有 n 个有趣的分钟 t1, t2, ..., tn。 你的任务是计算利马克会观看比赛多少分钟。

输入

输入的第一行包含一个整数 n (1 ≤ n ≤ 90) — 有趣的分钟数。

第二行包含 n 个整数 t1, t2, ..., tn (1 ≤ t1 < t2 < ... tn ≤ 90),以升序给出。

------------------------

问能看多少分钟的比赛,每次加当前精彩点的时间+15,去比对下一个精彩点的时间,如果超过90,返回,如果小于下一个精彩点的时间,直接退出循环即可,下面是代码:

标签: