UVa Problem 11462
Age Sort
Problem link:
https://uva.onlinejudge.org/index.php?option=onlinejudge&page=show_problem&problem=2457
Solution :
#include<bits/stdc++.h>
using namespace std;
int main()
{
long int a[2000005],i,n;
while (scanf("%ld",&n)!=EOF)
{
if (n==0)
{
break;
}
for (i=0;i<n;i++)
{
scanf("%ld",&a[i]);
}
sort(a,a+n);
for (i=0;i<n;i++)
{
printf("%ld",a[i]);
if (i<(n-1))
printf(" ");
}
printf("\n");
}
return 0;
}
No comments:
Post a Comment