编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#22225 #1119. Rhodoks的2-sum问题 Compile Error 0 0 ms 0 K C++ / 413 B 经济-栗龙斌 2020-02-12 1:04:16
显示原始代码
#include <iostream>
#include <map>
using namespace std;
long int a[500000] = {}, n, k, result;
int main() {
    map<long int, int> mp;
    scanf("%ld%ld", &n, &k);
    for (int i = 0; i < n; i++) {
        scanf("%ld", &a[i]);
        mp[a[i]] = i;
        result = k - a[i];
        if (mp.find(result) != mp.end()) {
            printf("Yes");
            return 0;
        }
    }
    printf("No");
    return 0;
}

编译信息

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