-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathBTCODE_A.cpp
70 lines (50 loc) · 1.19 KB
/
BTCODE_A.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <sstream>
#include <cmath>
#include <cassert>
#include <memory.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define sz(a) (int)(a).size()
#define _(a,b) memset((a), (b), sizeof(a))
void prepare()
{
}
long long gcd(long long a,long long b)
{
return b ? gcd(b, a % b) : a;
}
void solve()
{
long long x1,y1,x2,y2;
scanf("%ld%ld%ld%ld",&x1,&x2,&y1,&y2);
if (x1 < 0)
x1 = -x1;
if (y1 < 0)
y1 = -y1;
if (x2 < 0)
x2 = -x2;
if (y2 < 0)
y2 = -y2;
long long g1=gcd(x1,y1);
long long g2=gcd(x2,y2);
while(g1>0 && g1<g2)
g1*=2;
printf(g1!=g2?"NO\n":"YES\n");
}
int main()
{
int t;
scanf("%d",&t);
while(t--)
solve();
return 0;
}