记录详情

Accepted


  
# 状态 耗时 内存占用
#1 Accepted 2ms 212.0 KiB
#2 Accepted 1ms 220.0 KiB
#3 Accepted 1ms 228.0 KiB
#4 Accepted 1ms 216.0 KiB
#5 Accepted 1ms 228.0 KiB
#6 Accepted 1ms 216.0 KiB
#7 Accepted 1ms 228.0 KiB
#8 Accepted 1ms 220.0 KiB
#9 Accepted 1ms 228.0 KiB
#10 Accepted 1ms 220.0 KiB
#11 Accepted 0ms 224.0 KiB
#12 Accepted 0ms 220.0 KiB
#13 Accepted 0ms 216.0 KiB

代码

#include<stdio.h>
#include<string.h>
#include<math.h>
int main(){
  int n,m,k,pd[10001],i,j,q,s1,s2,a;
  scanf("%d%d%d",&n,&m,&k);
  for(i=1;i<=m;i++)pd[i]=1;
  for(i=m+1;i<=1+k;i++)pd[i]=0;
  for(i=k+2;i<=10000;i++){
  	s1=0;
  	for(j=1;j<=m;j++){
  		s2=1;
  		for(q=1;q<=k;q++){
  		   	if(pd[i-j-q]==0){s2=0;break;
				 }
		  }
		  if(s2==1){s1=1;break;
		  }
	  }
	  if(s1==1)pd[i]=1;
  }
  for(i=1;i<=n;i++){
  	scanf("%d",&a);
  //	for(j=1;j<=a;j++)printf("%d ",pd[j]);printf("\n");
  	if(pd[a]==0){
  		printf("No");
  		return 0;
	  }
  }
printf("Yes");
return 0;
}

信息

递交者
类型
递交
题目
P1002 hitwh 2019 新生赛 C cqsss and his enterprise
语言
C
递交时间
2020-12-17 14:10:20
评测时间
2020-12-17 14:10:20
评测机
分数
100
总耗时
16ms
峰值内存
228.0 KiB