Cod sursa(job #528088)
| Utilizator | Data | 1 februarie 2011 22:13:43 | |
|---|---|---|---|
| Problema | Sortare prin comparare | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.52 kb |
#include <iostream>
#include <fstream>
using namespace std;
const char iname[] = "algsort.in";
const char oname[] = "algsort.out";
const int nmax = 500005;
ifstream fin(iname);
ofstream fout(oname);
int v[nmax], n, i, j;
struct cmp
{
bool operator()(const int a, const int b)const
{
if(a < b)
return 1;
return 0;
}
};
int main()
{
fin >> n;
for(i = 1; i <= n; i ++)
fin >> v[i];
sort(v + 1, v + n + 1, cmp());
for(i = 1; i <= n; i++)
fout << v[i] << " ";
return 0;
}