Cod sursa(job #1194396)

Utilizator narcis_vsGemene Narcis - Gabriel narcis_vs Data 3 iunie 2014 19:34:06
Problema A+B Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.66 kb
#include <fstream>
#include <algorithm>
#include <fstream>
#define Lim 50000
#define Next (++pos==Lim)?(f.read(Buffer,Lim),pos = 0):0
using namespace std;
ifstream f("adunare.in");
ofstream g("adunare.out");
char Buffer[Lim];
int pos,a,b;
inline void Read(int &x)
{
    int semn =1;
    while(Buffer[pos]<'0' || '9'<Buffer[pos]){
        if(Buffer[pos]=='-')
            semn *= -1;
        Next;
    }
    x = 0;
    while('0'<=Buffer[pos] && Buffer[pos]<='9')
    {
        x = x*10 +Buffer[pos]-'0';
        Next;
    }
    x*=semn;
}

int main()
{
    f.read(Buffer,Lim);
    Read(a);
    Read(b);
    g<<a+b<<"\n";
    return 0;
}