编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#22192 | #1119. Rhodoks的2-sum问题 | Compile Error | 0 | 0 ms | 0 K | C++ / 511 B | paul0917 | 2020-02-11 22:45:48 |
#include <stdio.h>
#include <string.h>
#include <math.h>
int main() {
long long n, K;
int u = 0;
scanf("%lld %lld", &n, &K);
int p[500000];
gets(p);
int q[500000][500000];
for (int j = 0; j < n - 1; j++) {
for (int i = j; i < n; ++i) {
q[j][i] = p[j] + p[i];
}
}
for (int j = 0; j < strlen(p); j++) {
for (int i = 0; i < strlen(p); i++) {
if (q[j][i] == K) {
u++;
break;
}
}
}
if (u != 0)
printf("Yes");
else
printf("No");
return 0;
}
编译信息
/sandbox/1/a.cpp: In function 'int main()':
/sandbox/1/a.cpp:11:8: warning: 'char* gets(char*)' is deprecated [-Wdeprecated-declarations]
gets(p);
^
In file included from /usr/include/stdio.h:862,
from /sandbox/1/a.cpp:1:
/usr/include/bits/stdio2.h:232:1: note: declared here
gets (char *__str)
^~~~
/sandbox/1/a.cpp:11:8: warning: 'char* gets(char*)' is deprecated [-Wdeprecated-declarations]
gets(p);
^
In file included from /usr/include/stdio.h:862,
from /sandbox/1/a.cpp:1:
/usr/include/bits/stdio2.h:232:1: note: declared here
gets (char *__str)
^~~~
/sandbox/1/a.cpp:11:7: error: cannot convert 'int*' to 'char*'
gets(p);
^
In file included from /usr/include/stdio.h:862,
from /sandbox/1/a.cpp:1:
/usr/include/bits/stdio2.h:232:13: note: initializing argument 1 of 'char* gets(char*)'
gets (char *__str)
~~~~~~^~~~~
/sandbox/1/a.cpp:12:22: error: size of array 'q' is too large
int q[500000][500000];
^
/sandbox/1/a.cpp:17:4: error: 'q' was not declared in this scope
q[j][i] = p[j] + p[i];
^
/sandbox/1/a.cpp:20:29: error: cannot convert 'int*' to 'const char*'
for (int j = 0; j < strlen(p) ; j++)
^
In file included from /sandbox/1/a.cpp:2:
/usr/include/string.h:384:35: note: initializing argument 1 of 'size_t strlen(const char*)'
extern size_t strlen (const char *__s)
~~~~~~~~~~~~^~~
/sandbox/1/a.cpp:22:30: error: cannot convert 'int*' to 'const char*'
for (int i = 0; i < strlen(p); i++)
^
In file included from /sandbox/1/a.cpp:2:
/usr/include/string.h:384:35: note: initializing argument 1 of 'size_t strlen(const char*)'
extern size_t strlen (const char *__s)
~~~~~~~~~~~~^~~
/sandbox/1/a.cpp:24:8: error: 'q' was not declared in this scope
if (q[j][i]==K)
^
/sandbox/1/a.cpp:9:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%lld %lld", &n, &K);
~~~~~^~~~~~~~~~~~~~~~~~~~~