记录详情

Wrong Answer

/in/foo.c: In function 'fun':
/in/foo.c:4:2: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
  if(flag[step]=1)
  ^~
# 状态 耗时 内存占用
#1 Wrong Answer 1ms 216.0 KiB
#2 Wrong Answer 0ms 216.0 KiB
#3 Wrong Answer 0ms 128.0 KiB
#4 Accepted 0ms 220.0 KiB
#5 Wrong Answer 0ms 128.0 KiB
#6 Wrong Answer 0ms 224.0 KiB
#7 Accepted 0ms 128.0 KiB
#8 Wrong Answer 0ms 220.0 KiB
#9 Wrong Answer 0ms 224.0 KiB
#10 Wrong Answer 0ms 220.0 KiB
#11 Accepted 0ms 128.0 KiB
#12 Wrong Answer 0ms 220.0 KiB
#13 Accepted 0ms 128.0 KiB

代码

#include<stdio.h>
int flag[1000];
void fun(int a,int m,int k,int step){
	if(flag[step]=1)
	   return;
	if(a<=m){
		flag[step]=1;
	}else{
		int i;
		for(i=1;i<=m+k;i++){
			fun(a-i,m,k,step);
		}
	}
}
int main(){
	int n,m,k;
	int a[1000];
	scanf("%d %d %d",&n,&m,&k);
	int i;
	for(i=0;i<n;i++){
	   scanf("%d",&a[i]);
    }
    for(i=0;i<n;i++)
       fun(a[i],m,k,i);
    int count=0;
    for(i=0;i<n;i++)
	    if(flag[i]==1)
	       count++;
	if(count==n)printf("Yes\n");
	else printf("No\n");
	return 0;
}

信息

递交者
类型
递交
题目
P1002 hitwh 2019 新生赛 C cqsss and his enterprise
语言
C
递交时间
2020-12-19 19:04:24
评测时间
2020-12-19 19:04:24
评测机
分数
35
总耗时
11ms
峰值内存
224.0 KiB