4 条题解

  • 2
    @ 2024-9-8 10:36:50
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
        
        int k,m,yi=0,wu=0,shi=0;
       cin>>m;
        for(int i=1;i<=m;i++)
        { cin>>k;
           
            if(k==1){
                yi=yi+1;
            }
             if(k==5){
                wu=wu+1;
            }
            if(k==10)
            {
                shi=shi+1;
            }
        }
        cout<<yi<<" "<<wu<<" "<<shi;
    }
    
    • 1
      @ 2024-2-18 11:42:45
      #include<bits/stdc++.h>
      using namespace std;
      int main()
      {
          int a[101]={};
          int k,yi=0,wu=0,shi=0;
          cin>>k;
          for(int i=0;i<k;i++)
          {
              cin>>a[i];
              if(a[i]==1)
              {
                  yi=yi+1;
              }
              else if(a[i]==5)
              {
                  wu=wu+1;
              }
              else if(a[i]==10)
              {
                  shi=shi+1;
              }
          }
          cout<<yi<<" "<<wu<<" "<<shi;
      }
      
      • 0
        @ 2024-7-27 17:23:53

        #include<bits/stdc++.h> using namespace std; int main(){ int n,a,b=0,c=0,f=0; cin>>n; for(int i=1;i<=n;i++){ cin>>a; if(a1){ b++; } if(a5){ c++; } if(a==10){ f++; } } cout<<b<<" "<<c<<" "<<f; return 0; }

        • -1
          @ 2024-2-18 11:40:06
          #include<bits/stdc++.h>
          using namespace std;
          int main()
          {
              int a[101]={},n,q=1,w=5,e=10,s=1,d=1,f=1,z=0,x=0,c=0;
              cin>>n;
              for(int i=0;i<n;i++)
              {
                  cin>>a[i];
              }
              for(int i=0;i<n;i++)
              {
                  if(a[i]==q)
                  {
                      z=1+z;
                      s=0;
                  }
                  }
              for(int i=0;i<n;i++)
              {
                if(a[i]==w)
                  {
                      x=1+x;
                      d=0;
                  }   
              }
              for(int i=0;i<n;i++)
              {
                if(a[i]==e)
                  {
                      c=c+1;
                      f=0;
                  }   
              }
              cout<<z<<" ";
              cout<<x<<" "; 
              cout<<c;
              if(s==1) cout<<"0"<<" ";
              if(d==1) cout<<"0"<<" ";
              if(f==1) cout<<"0";
          	return 0; 
          }
          
          
          
          • 1

          信息

          ID
          1070
          时间
          1000ms
          内存
          256MiB
          难度
          3
          标签
          递交数
          183
          已通过
          63
          上传者