题解
2025-08-18 08:00:27
发布于:浙江
16阅读
0回复
0点赞
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin >> t;
while (t--) {
int x, y;
cin >> x >> y;
if (x > y) swap(x, y);
bool possible = false;
if ((x * y) % 2 != 0) {
possible = false;
}
else if (x == 1) {
possible = (y % 4 == 0);
}
else if (x == 2) {
possible = (y >= 3) && ((y % 4 == 0) || (y % 3 == 0) || (y % 4 == 3));
}
else if (x == 3) {
possible = (y % 2 == 0) && (y >= 2);
}
else if (x == 4) {
possible = true;
}
else {
possible = true;
}
cout << (possible ? "Yes" : "No") << '\n';
}
return 0;
}
这里空空如也
有帮助,赞一个