【題解】Codeforces 1395A. Boboniu Likes to Color Balls

【題目敘述】http://codeforces.com/contest/1395/problem/A

#include <iostream>
using namespace std;
 
int t, r, g, b, w;
 
int main() {
    cin >> t;
    while (t--){
        int even = 0;
        cin >> r >> g >> b >> w;
        if (r % 2 == 0) even++;
        if (g % 2 == 0) even++;
        if (b % 2 == 0) even++;
        if (w % 2 == 0) even++;
        if (even >= 3) cout << "Yes\n";
        else if (r > 0 && g > 0 && b > 0){
            if (4-even >= 3) cout << "Yes\n";
            else cout << "No\n";
        }
        else cout << "No\n";
    }
}
分享本文 Share with friends