编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#15578 #1. 快速排序 Compile Error 0 0 ms 0 K C++ / 390 B C192022214994 2024-03-16 13:01:19
显示原始代码
#include <iostream>
#include <vector>
#include <algorithm>
using namespace ::std;
int main() {
    int n;
    scanf("%d", &n) ; vector<int> vec;
    for (int i = 0; i < n; i++) {
        long v;
        scanf("%ld", &v);
        vec.push_back(v);
    }
    sort(vec.begin(), vec.end());
    for (int i = 0; i < n; i++) {
        printf("%ld", vec[i]);
    }
    return 0;
}

编译信息

/sandbox/1/a.cpp: In function 'int main()':
/sandbox/1/a.cpp:9:5: error: 'scanf' was not declared in this scope; did you mean 'wscanf'?
    9 |     scanf("%d",&n);
      |     ^~~~~
      |     wscanf
/sandbox/1/a.cpp:15:9: error: 'vec' was not declared in this scope
   15 |         vec.push_back(v);
      |         ^~~
/sandbox/1/a.cpp:17:10: error: 'vec' was not declared in this scope
   17 |     sort(vec.begin(),vec.end());
      |          ^~~
/sandbox/1/a.cpp:20:9: error: 'printf' was not declared in this scope
   20 |         printf("%ld",vec[i]);
      |         ^~~~~~
/sandbox/1/a.cpp:4:1: note: 'printf' is defined in header '<cstdio>'; did you forget to '#include <cstdio>'?
    3 | #include<algorithm>
  +++ |+#include <cstdio>
    4 | using namespace::std;