Cod sursa(job #125818)
Utilizator | Data | 20 ianuarie 2008 18:52:38 | |
---|---|---|---|
Problema | Fructe | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.37 kb |
#include<fstream.h>
#include<iostream.h>
int main()
{
long T,P,B,i,ok;
fstream a("fructe.in", ios::in);
fstream b("fructe.out", ios::out);
a>>T;
for(i=1; i<=T; i++)
{
a>>P>>B;
ok=2;
while(ok==2)
{
if(B>P){B=B-2; P++;}
else P--;
if((P==1)&&(B==0)) ok=0;
if((B==1)&&(P==0)) ok=1;
}
b<<ok<<endl;
}
a.close();
b.close();
return 0;
}