#include<bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int a[N];
int main()
{
cin.tie(0);
cout.tie(0);
ios::sync_with_stdio(false); // 提高cin的读取速度
int i,n;
cin >> n;
for(i = 0 ; i < n; i ++) cin >> a[i];
sort(a,a + n);
for(i = 0 ; i < n ; i ++) cout << a[i] << ' ';
return 0;
}
注意:
ios::sync_with_stdio(false)
要写在main()函数里面,不能当全局用
本文介绍了一个使用C++实现的快速排序算法,并通过ios::sync_with_stdio(false)来优化标准输入输出的效率,展示了从输入数据到排序输出的完整过程。
4239

被折叠的 条评论
为什么被折叠?



