Pagini recente » Cod sursa (job #2259216) | Cod sursa (job #412774) | Cod sursa (job #1823471) | Cod sursa (job #1933177) | Cod sursa (job #895500)
Cod sursa(job #895500)
Program copac;
var
p,b,x,n,cp,cb,i:longint;
cin,cout:text;
begin
assign(cin,'fructe.in');reset(cin);
assign(cout,'fructe.out');rewrite(cout);
read(cin,n);
for i:=1 to n do
begin
read(cin,p,b);
cp:=p;
cb:=b;
x:=p+b;
x:=x-2;
if (cp=p+1) and (cb=b+1) then
b:=b+1;
if (cp=p+2) or (cb=b+2) then
p:=p+1;
if (b=0) and (p=1) then
writeln(cout,0);
if (p=0) and (b=1) then
writeln(cout,1);
end;
close(cin);
close(cout);
end.