wait

来源:互联网 发布:罗技游戏鼠标 知乎 编辑:程序博客网 时间:2024/05/16 01:41

bzoj2299

等待

var
 t,i:longint;
 a,b,x,y,m:int64;

function gcd(a,b:int64):int64;
var
 r:int64;
begin
 if a>b then begin
  a:=a xor b;
  b:=a xor b;
  a:=a xor b;
 end;
 r:=a mod b;
 while r<>0 do begin
  a:=b;
  b:=r;
  r:=a mod b;
 end;
end;
begin
assign(input,'p.in');reset(input);
assign(output,'p.out');rewrite(output);
 readln(t);
 for i:=1 to t do begin
  readln(a,b,x,y);
  m:=gcd(a,b);
  if (x mod m<>0) or (y mod m<>0) then writeln('N')
  else if (a and 1=0) and (b and 1=0) then writeln('Y')
  else if (x and 1)=(y and 1) then writeln('Y')
  else writeln('N');
 end;
close(output);
end.

原创粉丝点击