C++ 灵能弹引爆判定 - 判断字符串中 '0' 的数量是否大于 '1'
#include<bits/stdc++.h> using namespace std; int main() { string s; cin>>s; int c0=0,c1=0; for(int i=0;i<s.size();i++) { if(s[i]=='0')c0++; else c1++; } if(c0>c1)cout<<'yes'; else cout<<'no'; return 0; }
原文地址: https://www.cveoy.top/t/topic/oUkh 著作权归作者所有。请勿转载和采集!