Pagini recente » Cod sursa (job #2216962) | Cod sursa (job #2609980) | Cod sursa (job #2417367) | Cod sursa (job #2401038) | Cod sursa (job #2336162)
#include <fstream>
#include <algorithm>
#define DIM 150000
using namespace std;
ofstream fout("algsort.out");
char buff [DIM];
int p = DIM-1;
void inc(){
p++;
if (p == DIM){
fread (buff, 1, DIM,stdin);
p=0;
}
}
void read(int &x){
while (buff[p] < '0' || buff[p] > '9')
inc();
x = 0;
while (buff [p] >= '0' && buff[p] <= '9'){
x = 10*x + buff[p] - '0';
inc();
}
}
int main(){
int n, v[500000], i;
freopen ("algsort.in", "r", stdin);
read(n);
for (i = 0;i < n;i++){
read(v[i]);
}
sort (v, v+n);
for (i = 0;i < n;i++)
fout << v[i] << " ";
return 0;
}