0w1

CFR 297 1A. Parity Game ( Ad hoc )

Problem - 297A - Codeforces
顯然1的數量最多只會變多一次,而且是當且僅當原本1的數量是奇數。排除掉那些情況後觀察一下就會發現怎樣都可以使a變成b的。

#include <bits/stdc++.h>
using namespace std;
const int MAXS = 1e3 + 3;

string a, b;

int countOne( const string &s ){
    int res = 0;
    for( int i = 0; i < s.size(); ++i )
        res += ( s[ i ] == '1' );
    return res;
}

int main(){
    cin >> a >> b;
    int acnt = countOne( a );
    int bcnt = countOne( b );
    acnt = acnt + 1 >> 1 << 1;
    if( acnt < bcnt ) cout << "NO\n";
    else cout << "YES\n";
    return 0;
}