提交时间:2024-05-05 17:02:12
运行 ID: 145749
#include<bits/stdc++.h> using namespace std; int main(){ int n,MAXN=0; cin>>n; int a[n]{}; for (int i=1;i<=n;i++){ cin>>a[i]; } for (int j=1;j<=n;j++){ if (a[j]>a[j+1]){ swap(a[j],a[j+1]); } } for (int u=1;u<=n;u++){ if (a[u]>a[u+1]){ swap(a[u],a[u+1]); } } for (int q=1;q<=n;q++){ if (a[q]>a[q+1]){ swap(a[q],a[q+1]); } } for (int m=1;m<=n;m++){ cout<<a[m]<<" "; } }