QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#301617 | #5475. Make a Loop | wxhtzdy | Compile Error | / | / | C++20 | 440b | 2024-01-10 03:49:46 | 2024-01-10 03:49:47 |
Judging History
answer
#include <stdio.h>
int min(int a, int b) { return a < b ? a : b; }
int n,a[101],dp[2][1000005];
int main(){
scanf("%d",&n);
for(int i=1;i<=n;i++) scanf("%d",&a[i]);
dp[0][0]=1;
int s=0;
for(int i=1;i<=n;i++){
s+=a[i];
for(int j=s;j>=x;j--){
for(int f=0;f<2;f++){
dp[f][j]=min(4,dp[f][j]+dp[f^1][j-a[i]]);
}
}
}
if(n%2==0&&s%2==0&&dp[0][s/2]>=4) printf("Yes\n"); else printf("No\n");
return 0;
}
詳細信息
answer.code: In function ‘int main()’: answer.code:14:32: error: ‘x’ was not declared in this scope 14 | for(int j=s;j>=x;j--){ | ^ answer.code:8:6: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 8 | scanf("%d",&n); | ~~~~~^~~~~~~~~ answer.code:9:28: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | for(int i=1;i<=n;i++) scanf("%d",&a[i]); | ~~~~~^~~~~~~~~~~~