P1170兔八哥与猎人 求助帖
查看原帖
P1170兔八哥与猎人 求助帖
292069
洋本羊楼主2020/10/18 08:47

求助大佬,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;
}

再次感谢更正!

2020/10/18 08:47
加载中...