题目描述
https://www.acwing.com/problem/content/787/
C++ 代码
include[HTML_REMOVED]
include[HTML_REMOVED]
using namespace std;
int q[1000010],n;
void qsort(int q[],int l,int r)
{
if(l>=r) return;
int x=q[l],i=l-1,j=r+1;
while(i[HTML_REMOVED]x);
if(i<j) swap(q[i],q[j]);
}
qsort(q,l,j);
qsort(q,j+1,r);
}
int main()
{
scanf(“%d”,&n);
for(int i=1;i<=n;i)
scanf(“%d”,&q[i]);
qsort(q,1,n);
for(int i=1;i<=n;i)
printf(“%d “,q[i]);
return 0;
}