18 条题解

  • 8
    @ 2022-12-20 21:34:44

    水题 AC代码:

    #include<iostream>
    using namespace std;
    int k,x,s1=0,s5=0,s10=0;
    int main(){
    	cin>>k;
    	for(int i=1;i<=k;i++){
    		cin>>x;
    		if(x==1)s1++;
    		if(x==5)s5++;
    		if(x==10)s10++;
    	}
    	cout<<s1<<endl<<s5<<endl<<s10;
    	return 0;
    }
    

    点个免费的赞再走吧!

    • 4

      送分

      #include <iostream>
      using namespace std;
      int main()
      {
      	long a,k,sum1=0,sum5=0,sum10=0;
      	cin>>k;
      	for(int i=1;i<=k;i++)
      	{
      		cin>>a;
      		if(a==1)
      		sum1+=1;
      		
      		if(a==5)
      		sum5+=1;
      		
      		if(a==10)
      		sum10+=1;
      		
      	}
      	cout<<sum1<<endl<<sum5<<endl<<sum10<<endl;
      }
      
      • 4
        @ 2022-2-5 12:07:03
        #include<iostream>
        #include<cstdio>
        #include<cstdlib>
        int k,n,a,b,c;
        using namespace std;
        int main()
        
        {
            cin>>k;
            
            for (int i = 1; i <= k; i++)
            {
                cin>>n;
                if (n==1)
                {
                    a++;
                }
                
                if (n==5)
                {
                    b++;
                }
                if (n==10)
                {
                    c++;
                }
            }
            cout<<a<<endl<<b<<endl<<c;
        }
        
        
        • 1
          @ 2024-6-19 19:52:19
          #include <iostream>
          using namespace std;
          int main()
          {
          int n,sum=0,num=0,ans=0;
          cin>>n;
          for(int i=1;i<=n;i++){
          int a;
          cin>>a;
          if(a==1)
          sum++;
          else if(a==5)
          num++;
          else if(a==10)
          ans++;
          }	
          	return 0;
          }
          
          • 1
            @ 2024-6-19 19:50:13
            #include <iostream>
            using namespace std;
            int main()
            {
            int n,sum=0,num=0,ans=0;
            cin>>n;
            for(int i=1;i<=n;i++){
            int a;
            cin>>a;
            if(a==1)
            sum++;
            else if(a==5)
            num++;
            else if(a==10)
            ans++;
            }	
            	return 0;
            }
            
            • 1
              @ 2024-6-19 19:48:34
              #include <iostream>
              using namespace std;
              int main()
              {
              int n,sum=0,num=0,ans=0;
              cin>>n;
              for(int i=1;i<=n;i++){
              int a;
              cin>>a;
              if(a==1)
              sum++;
              else if(a==5)
              num++;
              else if(a==10)
              ans++;
              }	
              	return 0;
              }
              
              
              • 1
                @ 2024-6-19 19:48:21
                #include <iostream>
                using namespace std;
                int main()
                {
                int n,sum=0,num=0,ans=0;
                cin>>n;
                for(int i=1;i<=n;i++){
                int a;
                cin>>a;
                if(a==1)
                sum++;
                else if(a==5)
                num++;
                else if(a==10)
                ans++;
                }	
                	return 0;
                }
                
                • 1
                  @ 2024-6-12 20:27:43
                  col1 col2 col3
                  #include
                  using namespace std;
                  int main(){
                  int n,sum=0,num=0,ans=0;
                  cin>>n;
                  for(int i=1;i<=n;i++){
                  int a;
                  cin>>a;
                  if(a==1)
                  sum++;
                  else if(a==5)
                  num++;
                  else if(a==10)
                  ans++;
                  }
                  printf("%d\n%d\n%d\n",sum,num,ans);
                  }
                  //dongliyang6666666666666666666skhjkfgjgkjhfgjDV
                  • 1
                    @ 2024-6-12 20:08:55
                    #include<cstdio>
                    #include<cstdlib>
                    #include<cmath>
                    #include<cctype>
                    #include<cstring>
                    #include<string>
                    #include<vector>
                    #include<set>
                    #include<stack>
                    #include<queue>
                    #include<iostream>
                    #include<iomanip>
                    #include<ctime>
                    #include<algorithm>
                    #include<map>
                    using namespace std;
                    int main(){
                        int n,a=0,b=0,c=0;
                        cin>>n;
                        for(int i=1;i<=n;i++){
                            int d;
                            cin>>d;
                            if(d==1)
                                a++;
                            else if(d==5)
                                b++;
                            else if(d==10)
                                c++;  
                        }
                        printf("%d\n%d\n%d\n",a,b,c);
                    }
                    
                    • 1
                      @ 2024-6-9 12:08:31
                      
                      
                      #include<iostream>
                      #include<iomanip>
                      #include<cstdio>
                      #include<cstring>
                      #include<cmath>
                      #include<algorithm>
                      #include<string>
                      #include<algorithm>
                      #define LL long long
                      using namespace std;
                      const int N=1e5+10;
                      const int Inf=0x3f3f3f3f;
                      LL n[N],f,a1,a5,a10;
                      int main(){
                      cin>>f;
                      for(LL i=0;i<f;i++){
                      cin>>n[i];
                      }for(LL i=0;i<f;i++){
                      if(n[i]==1){
                      a1++;
                      }if(n[i]==5){
                      a5++;
                      }if(n[i]==10){
                      a10++;
                      }
                      }
                      cout<<a1<<"\n"<<a5<<"\n"<<a10;
                      }
                      
                      
                      • 1
                        @ 2024-6-9 12:07:06
                        #include<iostream>
                        #include<iomanip>
                        #include<cstdio>
                        #include<cstring>
                        #include<cmath>
                        #include<algorithm>
                        #include<string>
                        #include<algorithm>
                        #define LL long long
                        using namespace std;
                        const int N=1e5+10;
                        const int Inf=0x3f3f3f3f;
                        LL n[N],f,a1,a5,a10;
                        int main(){
                        cin>>f;
                        for(LL i=0;i<f;i++){
                        cin>>n[i];
                        }for(LL i=0;i<f;i++){
                        if(n[i]==1){
                        a1++;
                        }if(n[i]==5){
                        a5++;
                        }if(n[i]==10){
                        a10++;
                        }
                        }
                        cout<<a1<<"\n"<<a5<<"\n"<<a10;
                        }
                        
                        • 1
                          @ 2024-3-12 21:06:27
                          #include <iostream>
                          #include <stdio.h>
                          #include <math.h>
                          #include <iomanip>
                          using namespace std;
                          const int N = 1e5 + 10;
                          const int INF = 0x3f3f3f3f;
                          int k , n , one , five , ten;
                          int main()
                          {
                          	cin >> k;
                          	for( int i = 1 ; i <= k ; i++ )
                          	{
                          		cin >> n;
                          		if( n == 1 )
                          		{
                          			one += 1;
                          		}
                          		else if( n == 5 )
                          		{
                          			five += 1;
                          		}
                          		else if( n == 10 )
                          		{
                          			ten += 1;
                          		}
                          	}
                          	cout << one << endl << five << endl << ten; 
                              return 0;
                          }
                          
                          
                          • 1
                            @ 2022-1-9 14:53:19
                            #include <iostream>
                            #include <math.h>
                            #include <iomanip>
                            using namespace std;
                            #define LL Long Long
                            const int N=1e5+10;
                            const int INF=0x3f3f3f3f;
                            int main()
                            {
                                cin >> k;
                                for (int i = 1 ; i <= k ; i++)
                                {
                                    cin >> n;
                                    if (n==1)
                                    {
                                        a++;
                                    }
                                    
                                    if (n==5)
                                    {
                                        b++;
                                    }
                                    if (n==10)
                                    {
                                        c++;
                                    }
                            }```
                            • 0
                              @ 2023-3-31 20:42:42

                              #include<bits/stdc++.h> using namespace std; int main() { int n,a[101],b[4]={0}; cin>>n; for(int i=1; i<=n; i++) { cin>>a[i]; if(a[i]==1) b[1]++; if(a[i]==5) b[2]++; if(a[i]==10) b[3]++; } cout<<b[1]<<endl<<b[2]<<endl<<b[3]; return 0; }

                              • 0
                                @ 2023-3-19 13:43:29

                                What water question!

                                //Accepted code:
                                #include <bits/stdc++.h>
                                /*#include <iostream>
                                #include <stdio.h>
                                #include <stdbool.h>
                                #include <iomanip>
                                #include <cstdio>
                                */
                                
                                //any function
                                void sleep(int p){
                                	long long int jiouiuiojioiouuiijyuiuyiyi = 0;
                                	const int N = 1e5 + 10;
                                	const int INF = 0x3f3f3f3f;
                                	for(int k = 1;k <= p;k++){
                                		for(int j = 1;j <= 300;j++){
                                			for(int i = 1;i <= N;i++){
                                			jiouiuiojioiouuiijyuiuyiyi += pow(N,N);
                                			}
                                		}
                                	}
                                }
                                
                                
                                //code write block
                                using namespace std;
                                const int N = 1e5 + 10;
                                const int INF = 0x3f3f3f3f;
                                int n,one,five,ten;
                                int main(){
                                
                                	cin >> n;
                                	for(int i = 1;i <= n;i++){
                                		int x;
                                		cin >> x;
                                		if(x == 1){
                                			one++;
                                		}
                                		else if(x == 5){
                                			five++;
                                		}
                                		else if(x == 10){
                                			ten++;
                                		}
                                	}
                                	cout << one << endl << five << endl << ten;
                                	return 0;
                                	}
                                
                                • 0
                                  @ 2022-7-5 22:10:13

                                  #include <stdio.h>

                                  #include <iostream>

                                  using namespace std;

                                  int main()

                                  {

                                  int n ;
                                  
                                  int a,b,c;
                                  
                                  a = b = c = 0;
                                  
                                  cin >> n;
                                  
                                  for(int i = 0;i < n;i++ )
                                  
                                  {
                                  
                                      int x;
                                  
                                      cin >> x;
                                  
                                      if(x == 1)
                                  
                                          a++;
                                  
                                      if(x == 5)
                                  
                                          b++;
                                  
                                      if(x == 10)
                                  
                                          c++;
                                  
                                  }
                                  
                                  cout << a << endl;
                                  
                                  cout << b << endl;
                                  
                                  cout << c << endl;
                                  

                                  }

                                  • 0
                                    @ 2022-7-5 8:39:49

                                    #include <stdio.h> #include <iostream> #include<cstdlib> using namespace std; int k,a,b,c,n; int main() {
                                    cin>>k; for(int i=0; i<k ;i++) {

                                    cin>>n;
                                    if(n==1)
                                    {
                                     a++;
                                    }
                                    
                                    if(n==5)
                                    {
                                    b=b+1;
                                    }
                                    
                                    if(n==10)
                                    {
                                    c=c+1;
                                    }
                                    
                                    }
                                    cout<<a<<endl;
                                    cout<<b<<endl;
                                    cout<<c<<endl;
                                    

                                    }

                                    • 0
                                      @ 2022-1-9 11:23:55
                                      #include<iostream>
                                      #include<cstdio>
                                      #include<cstdlib>
                                      int k,n,a,b,c;
                                      using namespace std;
                                      int main()
                                      
                                      {
                                          cin>>k;
                                          
                                          for (int i = 1; i <= k; i++)
                                          {
                                              cin>>n;
                                              if (n==1)
                                              {
                                                  a++;
                                              }
                                              
                                              if (n==5)
                                              {
                                                  b++;
                                              }
                                              if (n==10)
                                              {
                                                  c++;
                                              }
                                          }
                                          cout<<a<<endl<<b<<endl<<c;
                                      }
                                      
                                      • 1

                                      信息

                                      ID
                                      972
                                      时间
                                      1000ms
                                      内存
                                      128MiB
                                      难度
                                      3
                                      标签
                                      递交数
                                      664
                                      已通过
                                      332
                                      上传者