提交时间:2024-05-05 17:08:29

运行 ID: 145776

#include<iostream> using namespace std; int main(){ int a[100000]={0},c,b=1,i=1; cin>>c; while(b<=c){ cin>>a[b]; b++; } for(b=1;b<=c-1;b++){ for(i=1;i<=c-b;i++){ if(a[i]>a[i+1]){ swap(a[i],a[i+1]); } } } b=1; while(b<=c){ cout<<a[b]<<" "; b++; } return 0; }