mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-08 15:18:46 +00:00
parent
63eace5d98
commit
77bdd51811
30
Luogu/P2520/P2520.cpp
Normal file
30
Luogu/P2520/P2520.cpp
Normal file
@ -0,0 +1,30 @@
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
|
||||
using std::cin;
|
||||
using std::cout;
|
||||
const char endl = '\n';
|
||||
|
||||
int t, a, b, x, y;
|
||||
|
||||
int main() {
|
||||
std::ios::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
cin >> t;
|
||||
|
||||
while (t--) {
|
||||
cin >> a >> b >> x >> y;
|
||||
|
||||
int g = std::__gcd(a, b) * 2;
|
||||
a %= g, b %= g, x %= g, y %= g;
|
||||
|
||||
auto check = [&](int x, int y) -> bool {
|
||||
return x % g == 0 && y % g == 0;
|
||||
};
|
||||
|
||||
cout << (check(x, y) || check(x + a, y + b) || check(x + b, y + a) || check(x + a + b, y + a + b) ? "Y" : "N") << endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user