Cod sursa(job #860695)

Utilizator Gusti666Lucaciu Catalin Gusti666 Data 20 ianuarie 2013 17:42:10
Problema Fructe Scor 100
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.39 kb
var p,b,x,min,t,i:integer;
f,g:text;
begin
assign(f,'fructe.in');reset(f);
assign(g,'fructe.out');rewrite(g);
read(f,t);
for i:=1 to t do begin
read(f,p);
read(f,b);
repeat
if p>0 then begin p:=p-1; b:=b-1; b:=b+1; end;
if b>=2 then begin b:=b-2; p:=p+1; end;
until ((p=1) and (b=0)) or ((p=0) and (b=1));
if p=1 then writeln(g,0)
else writeln(g,1);
end;
close(f);
close(g);
end.