#14642: c++


100318 (曹吉百)

學校 : 臺北市立建國高級中學
編號 : 69094
來源 : [210.71.78.244]
最後登入時間 :
2020-11-04 13:56:05
a104. 排序 -- yoooooooo | From: [203.72.178.252] | 發表日期 : 2018-07-27 13:41

#include <bits/stdc++.h>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char** argv) {
int n,i,j,t;
while(cin>>n)
{
int a[n];
for(i=0; i<n; ++i) cin>>a[i];
for(i=0; i<n; ++i)
{
for(j=i+1; j<n; --j)
if(a[i]>a[j]) {t=a[i]; a[i]=a[j]; a[j]=t;}
}
for(i=0; i<n; ++i) cout<<a[i]<<" ";
cout <<endl;
}
return 0;
}

 
ZeroJudge Forum