Cod sursa(job #240528)
| Utilizator | Data | 7 ianuarie 2009 20:48:35 | |
|---|---|---|---|
| Problema | Sortare prin comparare | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.51 kb |
#include<stdio.h>
#include<algorithm>
using namespace std;
int nr[500100];
char s[5000100];
int main(){
freopen("algsort.in","r",stdin);
freopen("algsort.out","w",stdout);
int n,i,j=0,a;
char x[10];
scanf("%d",&n);
fgets(x,10,stdin);
fgets(s,n*10+10,stdin);
for(i=0;i<n;++i){
a=0;
while('0'<=s[j] && s[j]<='9')
a=a*10+s[j++]-'0';
++j;
nr[i]=a;
}
sort(nr,nr+n);
for(i=0;i<n-1;++i)
printf("%d ",nr[i]);
printf("%d\n",nr[n-1]);
fclose(stdin);
fclose(stdout);
return 0;
}
