Cod sursa(job #284462)
| Utilizator | Data | 21 martie 2009 18:33:12 | |
|---|---|---|---|
| Problema | Sortare prin comparare | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.43 kb |
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
int n, i, x;
vector <int> V;
int main(){
FILE *f = fopen("algsort.in", "r");
FILE *g = fopen("algsort.out", "w");
fscanf(f,"%d",&n);
for(i=1; i<=n; i++){
fscanf(f,"%d",&x);
V.push_back(x);
}
sort(V.begin(), V.end());
for(i=0; i < V.size(); i++)
fprintf(g,"%d ",V[i]);
fclose(f);
fclose(g);
return 0;
}
