| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 149537 | 谭思宸 | 选择排序 | C++ | Compile Error | 0 MS | 0 KB | 365 | 2026-03-14 10:42:18 |
#include<bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } int Min, t; for (int j = 0; j <= n - 2; j++) { Min = j; for (int i = j + 1; i <= n - 1; i++) { if (a[i] < a[Min]) { Min = i; } } t = a[j]; a[j] = a[Min]; a[Min] = t; } for (int i = 0; i <= n - 1; i++) { cout << a[i] << " "; } return 0;
Main.cc:1:25: warning: extra tokens at end of #include directive
#include using namespace std; int main() { int n; cin >> n; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } int Min, t; for (int j = 0; j <= n - 2; j++) { Min = j; for (int i = j + 1; i <= n - 1; i++) { if (a[i] < a[Min]) { Min = i; } } t = a[j]; a[j] = a[Min]; a[Min] = t; } for (int i = 0; i <= n - 1; i++) { cout << a[i] << " "; } return 0;
^
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status