编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#22333 | #1119. Rhodoks的2-sum问题 | Compile Error | 0 | 0 ms | 0 K | C / 376 B | paul0917 | 2020-02-12 14:37:41 |
#include <stdio.h>
#include <string.h>
int main() {
int n, K;
scanf("%d %d", n, K);
int num = 0;
int a[500000];
for (int i = 0; i < n; i++) {
scanf("%d", a[i]);
for (int j = i; j != 0; --j;) {
if (a[i] + a[j] == K) {
num++;
break;
}
}
}
if (num == 0) {
printf("No");
} else {
printf("Yes");
}
return 0;
}
编译信息
/sandbox/1/a.c:7:17: warning: format specifies type 'int *' but the argument has type 'int' [-Wformat]
scanf("%d %d", n, K);
~~ ^
/sandbox/1/a.c:7:20: warning: format specifies type 'int *' but the argument has type 'int' [-Wformat]
scanf("%d %d", n, K);
~~ ^
/sandbox/1/a.c:12:15: warning: format specifies type 'int *' but the argument has type 'int' [-Wformat]
scanf("%d", a[i]);
~~ ^~~~
/sandbox/1/a.c:13:30: error: unexpected ';' before ')'
for (int j = i; j != 0; --j;)
^
3 warnings and 1 error generated.