题解 | 小红的01串

小红的01串

https://www.nowcoder.com/practice/8920f77fb2c0409a9f4f9025969110de?channelPut=tracker2

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll t;
void solve() {
    string s;
    while(t--){
        cin>>s;
        ll len = s.length();
        ll num1 = 0;
        ll num0 = 0;
        for(char str : s){
            if(str=='1')num1++;
            else num0++;
        }
        if(num1%2!=0&&num0%2!=0){
            cout<<"No"<<endl;
        }
        else cout<<"Yes"<<endl;
    }
}
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cin>>t;
    solve();
    return 0;
}

全部评论

相关推荐

牛客52811839...:实习要写出来业务和产出,你这写的像流水账没人看。项目经历也没有,换个极简简历试试
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务