To_Heart—题解——HAOI2011向量
题目链接
代码如下:
#include<bits/stdc++.h>
using namespace std;
long long GCD(long long a,long long b){
if(b==0)
return a;
return GCD(b,a%b);
}
long long ans=1;
bool Cheak(long long x,long long y){
return (!(x%ans))&&(!(y%ans));
}
int main(){
int t;
scanf("%d",&t);
while(t--){
long long a,b,x,y;
scanf("%lld%lld%lld%lld",&a,&b,&x,&y);
ans=GCD(a,b)>>1;
if((x%GCD(a,b)==0)&&(y%GCD(a,b)==0)&&((x+y)%GCD(a-b,a+b)==0)){
printf("Y\n");
continue;
}
printf("N\n");
}
return 0;
}