编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#22805 #1119. Rhodoks的2-sum问题 Compile Error 0 0 ms 0 K C++ / 474 B xjtucvpr1 2020-02-14 21:31:10
显示原始代码
#include <iostream>
#include <vector>

using namespace std;
int main() {
    long long K, t;
    int n, i, j, flag = 0;
    vector<long long> a;
    scanf("%d %lld", &n, &K);
    for (i = 0; i < n; i++) {
        scanf("%lld", &t);
        a.push_back(t);
    }

    for (i = 0; i < n - 1; i++) {
        for (j = i + 1; j < n; j++) {
            if (a[i] + a[j] == K) {
                flag = 1;
                break;
            }
        }
    }
    if (flag)
        printf("Yes\n");
    else
        printf("No\n");
    return 0;
}

编译信息

/sandbox/1/a.cpp: In function 'int main()':
/sandbox/1/a.cpp:9:5: error: 'scanf' was not declared in this scope
     scanf("%d %lld",&n,&K);
     ^~~~~
/sandbox/1/a.cpp:9:5: note: suggested alternative: 'wscanf'
     scanf("%d %lld",&n,&K);
     ^~~~~
     wscanf
/sandbox/1/a.cpp:24:6: error: 'printf' was not declared in this scope
      printf("Yes\n");
      ^~~~~~
/sandbox/1/a.cpp:24:6: note: 'printf' is defined in header '<cstdio>'; did you forget to '#include <cstdio>'?
/sandbox/1/a.cpp:3:1:
+#include <cstdio>
 
/sandbox/1/a.cpp:24:6:
      printf("Yes\n");
      ^~~~~~
/sandbox/1/a.cpp:26:6: error: 'printf' was not declared in this scope
      printf("No\n");
      ^~~~~~
/sandbox/1/a.cpp:26:6: note: 'printf' is defined in header '<cstdio>'; did you forget to '#include <cstdio>'?