Pagini recente » Cod sursa (job #1238491) | Cod sursa (job #2417889) | Cod sursa (job #766738) | Cod sursa (job #1010768) | Cod sursa (job #1316655)
/**
* @author Adrian Statescu <[email protected]>
* @description std::sort the elements in the range [first, last) in Action.
* @License MIT
*/
#include <stdio.h>
#include <string.h>
#include <algorithm>
#define FIN "algsort.in"
#define FOUT "algsort.out"
#define MAXN 500005
int vec[ MAXN ],
N;
char str[ 5500000 ];
int main() {
freopen(FIN, "r", stdin);
scanf("%d\n", &N);
gets(str);
fclose( stdin );
str[ strlen( str ) ] = ' ';
int j = 0;
for(int i = 0; i < N; ++i) {
int num = 0;
while(str[ j ] != ' ') {
num = num * 10 + str[ j++ ] - '0';
}
j++;
vec[ i ] = num;
}
std::sort(vec,vec + N);
freopen(FOUT, "w", stdout);
for(int i = 0; i < N; ++i) printf("%d ", vec[ i ]);
fclose( stdout );
return(0);
};