P5660 [CSP-J2019] 数字游戏 10.27 Wsy0326 · 2025-10-27 20:53:21 · 题解 题目大意 在一串字符串中有多少个字符1 思路 遍历字符串的每个字符,若为1则次数++ for(int i=0;i<=s.size();i++){ if(s[i]=='1'){ ans++; } } cout<<ans<<endl;