Cod sursa(job #1519841)

Utilizator jimcarterJim Carter jimcarter Data 7 noiembrie 2015 22:06:44
Problema Sortare prin comparare Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 0.53 kb
#include <cstdio>
#include <algorithm>
using namespace std;

FILE *f = fopen ( "sort.in" , "r" ) , *g = fopen ( "sort.out" , "w" );

const int MAX = 500005;
int Size , myInts [ MAX ] , i;

void read()
{
    fscanf ( f , "%d" , &Size );
    for ( i = 0 ; i < Size ; i ++ )
        fscanf ( f , "%d" , &myInts [ i ] );
}

void print()
{
    for ( i = 0 ; i < Size ; i ++ )
        fprintf ( g , "%d " , myInts [ i ] );
}

int main()
{
    read();
    sort ( myInts , myInts + Size );
    print();
    return 0;
}