51nod_1247可能的路径
2017-07-24 16:28
330 查看
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#include<map>
#include<string>
using namespace std;
int t;
long long a, b;
long long c, d;
long long gcd(long long x, long long y)
{
return y == 0 ? x : gcd(y, x%y);
}
long long extgcd(long long a, long long b, long long &x, long long &y)
{
if (b == 0)
{
x = 1;y = 0;
return a;
}
long long r = extgcd(b, a%b, x, y);
long long t = x;
x = y;
y = t - a / b*y;
return r;
}
int main()
{
scanf("%d", &t);
while (t--)
{
scanf("%lld %lld %lld %lld", &a, &b, &c, &d);
if (gcd(a,b)==gcd(c,d))
printf("Yes\n");
else
printf("No\n");
}
return 0;
}
相关文章推荐
- 51nod 1247 可能的路径
- 【51nod】1247 可能的路径
- 51nod 1247 可能的路径
- 51nod 1247 可能的路径
- 51nod 1247 可能的路径 (最大公约数变形)
- 51Nod-1247-可能的路径
- 51Nod 1247 可能的路径
- AC日记——可能的路径 51nod 1247
- 51nod 1247 可能的路径
- 51NOD 1247 可能的路径 GCD
- 51nod 1247 可能的路径
- 1247 可能的路径 逆向思维
- 51 nod 1247 可能的路径(exgcd)
- 51nod 可能的路径
- 51nod 1274 最长递增路径【DP】
- 51nod 1274 最长递增路径[dp]
- 51nod 1076 2条不相交的路径
- 51nod 1076 2条不相交的路径【边双连通+染色】
- 分享一个技巧,利用批处理调用ruby脚本(可能你为路径苦恼)
- 安装VS2005 SP1出现这样问题“windows 无法访问指定设备、路径或文件。您可能没有合适的权限访问这个项目。”