求助大佬,wa了两发qwq(回复请@一下,不常看洛谷)
#include<bits/stdc++.h>
using namespace std;
int gcd(int x,int y)
{
if(x%y==0)
return y;
else
return gcd(y,x%y);
}
int n;
int ax,ay,bx,by;
int main()
{
cin>>n;
while(n--)
{
cin>>ax>>ay>>bx>>by;
if(ax==bx||ay==by)
{
if((abs(bx-ax))+(abs(by-ay))>1)
cout<<"yse"<<endl;
else
cout<<"no"<<endl;
continue;
}
if(gcd(abs(bx-ax),abs(by-ay))==1)
cout<<"no"<<endl;
else
cout<<"yes"<<endl;
}
return 0;
}
再次感谢更正!