Pagini recente » Cod sursa (job #546063) | Cod sursa (job #1002158) | Cod sursa (job #682017) | Cod sursa (job #1530634) | Cod sursa (job #1976648)
#include <iostream>
#include<algorithm>
#include<fstream>
using namespace std;
#define DIM 10000
char buff[DIM];
int poz;
inline void R(int&x)
{
x=0;
while(buff[poz]<'0' || buff[poz]>'9')
if(++poz==DIM)
{
poz=0;
f.read(buff,DIM);
}
while(buff[poz]>='0' && buff[poz]<='9')
{
x=x*10+buff[poz]-'0';
if(++poz==DIM)
{
poz=0;
f.read(buff,DIM);
}
}
}
int v[500500],i,n;
inline bool cmp(int a,int b)
{
return(a<b);
}
int main()
{
ifstream f("algsort.in");
R(n);
for(i=0;i<n;++i)
R(v[i]);
sort(v,v+n,cmp);
ofstream g("algsort.out");
for(i=0;i<n;++i)
g<<v[i]<<' ';
return 0;
}