Saturday, July 12, 2014

UVa - 11462 - Age Sort

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main(){
    int t, n;
    vector <int> ans;
    while(cin >> t){
        if(t == 0)break;
        for(int i = 0; i < t; i++){
            cin >> n;ans.push_back(n);
        }
        sort(ans.begin(), ans.end());
        for(int i = 0; i < t; i++){
            cout << ans[i];
            if(i == (t-1))break;
            cout << " ";
        }cout << endl;
        ans.clear();
    }
    return 0;
}

No comments:

Post a Comment