【CodeForces】[673A]Bear and Game

文章字数:145

问题描述

问题分析

因为已经说最多持续90分钟
所以可以进行循环模拟看电视的过程
从而统计最多可看几分钟

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include<stdio.h>
#include<string.h>
int a[100];
int main() {
	int n;
	while(scanf("%d",&n)!=EOF) {
		memset(a,0,sizeof(a));
		for(int i=1; i<=n; i++) {
			int t;
			scanf("%d",&t);
			a[t]=1;
		}
		int res=0,t=0;
		for(int i=1; i<=90; i++) {
			res++;
			if(a[i])
				t=0;
			else
				t++;
			if(t>=15)
				break;
		}
		printf("%d\n",res);
	}
	return 0;
}

题目地址:【CodeForces】[673A]Bear and Game

该内容采用 CC BY-NC-SA 4.0 许可协议。

如果对您有帮助或存在意见建议,欢迎在下方评论交流。

加载中...