记录详情

Accepted

foo.cc: In function 'int main()':
foo.cc:7:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d%d",&n,&m,&k);
  ~~~~~^~~~~~~~~~~~~~~~~~~
foo.cc:24:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&a);
   ~~~~~^~~~~~~~~
正在同步测试数据,请稍后
# 状态 耗时 内存占用
#1 Accepted 3ms 384.0 KiB
#2 Accepted 2ms 356.0 KiB
#3 Accepted 2ms 384.0 KiB
#4 Accepted 2ms 384.0 KiB
#5 Accepted 2ms 384.0 KiB
#6 Accepted 1ms 384.0 KiB
#7 Accepted 2ms 384.0 KiB
#8 Accepted 1ms 384.0 KiB
#9 Accepted 3ms 384.0 KiB
#10 Accepted 1ms 384.0 KiB
#11 Accepted 1ms 384.0 KiB
#12 Accepted 2ms 384.0 KiB
#13 Accepted 1ms 384.0 KiB

代码

#include<bits/stdc++.h>
#define N 10001
using namespace std;
int n,m,k,flag;
int a,ans[N],v[N];
int main(){
	scanf("%d%d%d",&n,&m,&k);
	for(int i = 1; i <= m; i++) v[i] = 1;
	for(int i = m + 1; i < N; i++){
		for(int j = 1; j <= m; j++){
			flag = 0;
			for(int l = 1; l <= k; l++)
			if(!v[i - j - l]){
				flag = 1;
				break;
			}
			if(!flag){
				v[i] = 1;
				break; 
			}
		}
	}
	for(int i = 1; i <= n; i++){
		scanf("%d",&a);
		if(!v[a]){
			printf("No\n");
			exit(0);
		}
	}
	printf("Yes\n");
	return 0;
	
}

信息

递交者
类型
递交
题目
P1002 hitwh 2019 新生赛 C cqsss and his enterprise
语言
C++
递交时间
2020-12-21 18:12:56
评测时间
2020-12-21 18:12:56
评测机
分数
100
总耗时
29ms
峰值内存
384.0 KiB