Run ID:70246
提交时间:2024-04-14 11:12:01
#include <bits/stdc++.h> using namespace std; int n; int main() { cin>>n; int a[2000]= {0}; for(int i=0; i<n; i++) { cin>>a[i]; } int flog=0; for(int i=0; i<n-1; i++) { for(int j=0; j<n-1; i++) { if(a[j]>a[j+1]) { swap(a[j],a[j+1]); } if(flog==0) break; } } for(int i=0; i<n; i++) { cout<<a[i]<<" "; } return 0; }