stone_3.pas 719 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. Program Stone_Algorithm3;
  2. Const
  3. inf='stone.in';
  4. outf='stone.out';
  5. phi=(sqrt(5)+1)/2;
  6. Var
  7. a,b:longint;
  8. procedure swap;
  9. var t:longint;
  10. begin
  11. t:=a; a:=b; b:=t;
  12. end;
  13. procedure main;
  14. var t:longint;
  15. begin
  16. assign(input,inf); reset(input);
  17. assign(output,outf); rewrite(output);
  18. while not(seekeof) do
  19. begin
  20. read(a,b);
  21. if a>b then swap;
  22. if a+b=0 then begin
  23. writeln(0); continue;
  24. end;
  25. t:=trunc(a/phi+1);
  26. if (a=trunc(t*phi)) and (b=a+t)
  27. then writeln(0) else writeln(1);
  28. end;
  29. close(input); close(output);
  30. end;
  31. Begin
  32. main;
  33. End.