编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#22188 | #1119. Rhodoks的2-sum问题 | Compile Error | 0 | 0 ms | 0 K | C++ / 460 B | 电类937权冬瑞 | 2020-02-11 22:44:36 |
#include <stdio.h>
#include <vector>
int main() {
int n, k;
scanf("%d,%d", &n, &k);
std::vector<int> a;
std::vector<int>::iterator p = a.begin();
for (int i = 0; i < n - 1; i++) {
scanf("%d", &(p + i));
}
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
if (*(p + i) + *(p + j) == k) {
printf("Yes");
} else {
printf("No");
}
}
}
return 0;
}
编译信息
/sandbox/1/a.cpp: In function 'int main()':
/sandbox/1/a.cpp:9:25: error: taking address of temporary [-fpermissive]
scanf("%d",&(p+i));
^
/sandbox/1/a.cpp:9:15: warning: format '%d' expects argument of type 'int*', but argument 2 has type '__gnu_cxx::__normal_iterator<int*, std::vector<int> >*' [-Wformat=]
scanf("%d",&(p+i));
^~~~ ~~~~~~
/sandbox/1/a.cpp:5:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d,%d",&n ,&k);
~~~~~^~~~~~~~~~~~~~~~
/sandbox/1/a.cpp:9:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&(p+i));
~~~~~^~~~~~~~~~~~~