#45520: 既然是1121228z2stu.wghs.tp.edu.tw推薦的,那我就寫一下解體報告吧(被罵的話再說)


1121226@stu.wghs.tp.edu.tw (Arthur✨小蜜蜂)

學校 : 臺北市私立薇閣高級中學
編號 : 252772
來源 : [60.248.154.143]
最後登入時間 :
2025-04-09 15:55:05
d190. 11462 - Age Sort -- UVa11462 | From: [60.248.154.143] | 發表日期 : 2025-03-12 15:32

#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    while(cin>>n){ //  重複輸入n 
        int a[n];
        if(n==0) break; //  若n=0則結束程式
        for(int i=0;i<n;i++) cin>>a[i]; //  輸入陣列a
        sort(a,a+n); //  排序陣列a
        for(int i=0;i<n-1;i++){ //  輸出陣列a
            cout<<a[i]<<" ";
        }
        cout<<a[n-1]<<endl;
    }
    return 0;
}
 
ZeroJudge Forum