Created
February 17, 2017 02:46
-
-
Save dada8397/b3ad7e7c55d67befd76997fbeead7606 to your computer and use it in GitHub Desktop.
UVa 11462 - Age Sort
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <vector> | |
#include <cstdio> | |
#include <algorithm> | |
using namespace std; | |
int main(void) { | |
int n; | |
while(scanf("%d", &n) != EOF) { | |
if(n==0) break; | |
vector<int> v; | |
int age; | |
for(int i=0; i<n; i++) { | |
scanf("%d", &age); | |
v.push_back(age); | |
} | |
sort(v.begin(), v.end()); | |
for(int i=0; i<v.size(); ++i) { | |
if(i > 0) printf(" "); | |
printf("%d", v[i]); | |
} | |
printf("\n"); | |
v.clear(); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment