@[lab1224](/user/1136324) 数组太小了,而且这题要用sort。而且不要发一堆感叹号
by Guo1 @ 2024-01-30 10:27:23
```c
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int n;
cin >> n;
int arr[n];
for (int i = 0; i < n; ++i) {
cin >> arr[i];
}
sort(arr, arr + n);
for (int i = 0; i < n; ++i) {
cout << arr[i] << " ";
}
return 0;
}
```
by timmyliao @ 2024-01-30 10:29:16
@[Guo1](/user/743879) 谁说一定要用 sort。[归并](https://www.luogu.com.cn/record/113961516) [快排](https://www.luogu.com.cn/record/129698917)
by xiaoshumiao @ 2024-01-30 10:29:22
@[timmyliao](/user/1095093) 最好不要输入n之后定义数组,不严谨。直接在前面写int arr[10001]不香吗
by Guo1 @ 2024-01-30 10:31:28
话说这是 sort 的天下吗,掌握各种排序也很重要。
[归并推广](https://www.luogu.com.cn/problem/P1908) [快排推广](https://www.luogu.com.cn/problem/P1923)
by xiaoshumiao @ 2024-01-30 10:31:39