Cod sursa(job #455380)

Utilizator SpiderManSimoiu Robert SpiderMan Data 13 mai 2010 17:33:21
Problema Operatii Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.81 kb
#include <cstdio>

#define FIN  "operatii.in"
#define FOU  "operatii.out"
#define LIN  unsigned int
#define hg 8192

int V, AUX , N, poz;
LIN rez;
char ch[hg];

inline int cit (int &x)
{
    x = 0;
    if (ch[0]=='\0') fread (ch, 1, hg, stdin);
    else while (ch[poz] < '0' || ch[poz] > '9')
            if (++poz == hg)
                fread (ch, 1, hg, stdin), poz = 0;

    while (ch[poz] >= '0' && ch[poz] <= '9')
    {
        x = x * 10 + ch[poz] - '0';
        if (++poz == hg)
            fread (ch, 1, hg, stdin), poz = 0;
    }
    return x;
}
int main()
{
    freopen(FIN , "r" , stdin);
    freopen(FOU , "w" , stdout);

    cit(N);

    for (LIN i = 1; i <= N; AUX = V, i++)
        if ( cit(V) > AUX)
            rez += V - AUX;


    printf("%u", rez);

    return 0;
}