编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#22254 #1119. Rhodoks的2-sum问题 Compile Error 0 0 ms 0 K C++ / 403 B 电类937权冬瑞 2020-02-12 9:57:23
显示原始代码
#include <iostream>
#include <set>
int main() {
    long int n, k;
    scanf("%ld,%ld", &n, &k);
    std::set<long int> a;
    for (long int i = 0; i < n; i++) {
        long int x;
        scanf("%ld", &x);
        int t = a.count(k - x);
        a.insert(x);
        if (t) {
            printf("Yes");
            return 0;
        }
    }
    printf("No");
    return 0;
}

编译信息

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