直接判断兔八哥对于猎人的横纵坐标之差的绝对值,然后判断其是否互质(题解一楼的思路)
#include<bits/stdc++.h>
using namespace std;
bool huzhi(int a,int b){
for(int i=2;i<=a;i++){
if(a%i==0){
if(b%i==0){
return false;
}
}
}
return true;
}
int gcd(int x,int y){
if(x<=1||y<=1) return 0;
if(huzhi(x,y)) return 1;
else return 0;
}
int main(){
int n;
cin>>n;
while(n--){
int tx,ty,lx,ly;
cin>>lx>>ly>>tx>>ty;
if(abs(lx-tx),abs(ly-ty)==1) cout<<"no"<<endl;
else cout<<"yes"<<endl;
}
return 0;
}