Skip to content

Instantly share code, notes, and snippets.

@dada8397
Created February 17, 2017 02:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dada8397/b3ad7e7c55d67befd76997fbeead7606 to your computer and use it in GitHub Desktop.
Save dada8397/b3ad7e7c55d67befd76997fbeead7606 to your computer and use it in GitHub Desktop.
UVa 11462 - Age Sort
#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