2 solutions

  • 1
    @ 2026-3-20 21:04:56
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
        cout<<"li 3\nzhang 3\nsun 4";
    }
    
    • 0
      @ 2026-3-26 19:32:49

      #include<bits/stdc++.h> using namespace std; struct pro { string name; int c; }a[3]={{"li",0},{"sun",0},{"zhang",0}}; int main() { int n; string s; cin>>n; for(int i=0;i<n;i++) { cin>>s; if(a[0].names) a[0].c++; else if(a[1].names) a[1].c++; else a[2].c++; } for (int i=0;i<3;i++) { cout<<a[i].name<<" "<<a[i].c<<endl; } return 0; }

      • 1

      Information

      ID
      1846
      Time
      1000ms
      Memory
      256MiB
      Difficulty
      7
      Tags
      # Submissions
      41
      Accepted
      10
      Uploaded By