Cod sursa(job #395133)
| Utilizator | Data | 12 februarie 2010 10:42:20 | |
|---|---|---|---|
| Problema | A+B | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.5 kb |
#include<fstream>
#include<stdlib.h>
using namespace std;
int n, v[500001];
void citire();
void afisare();
int cmp (void const *a, void const *b)
{
return *(int*)a - *(int*)b;
}
int main()
{
citire();
qsort(v, n , sizeof(v[0]), cmp);
afisare();
return 0;
}
void citire()
{
int i;
ifstream f ("algsort.in");
f>>n;
for (i=0;i<n;i++)
{
f>>v[i];
}
f.close();
}
void afisare()
{
ofstream g ("algsort.out");
int i;
for (i=0;i<n;i++)
{
g<<v[i]<<" ";
}
g.close();
}
