2 solutions

  • 1
    @ 2026-1-24 21:36:50

    不太喜欢某位大神的作弊方法,补发题解:

    #include <bits/stdc++.h>
    using namespace std;
    int main() {
        string s;
        cin >> s;
        int count = 0;
        for (char c : s) {
            if (c == '1') {
                count++;
            }
        }
        cout << count << endl;
        return 0;
    }
    
    • -1
      @ 2026-1-24 15:15:32
      #include<bits/stdc++.h>
      using namespace std;
      int main()
      {
          string a;
          int s=0;
          cin>>a;
          for(int i=0;i<a.length();i++)if(a[i]=='1')s++;
          cout<<s;
      }
      
      • 1

      Information

      ID
      433
      Time
      1000ms
      Memory
      256MiB
      Difficulty
      10
      Tags
      (None)
      # Submissions
      4
      Accepted
      3
      Uploaded By