3 条题解

  • 1
    @ 2024-1-30 12:07:54

    已AC,请放心食用

    #include <iostream>
    using namespace std;
    int main()
    {
        int n, a[10], sum1 = 0, sum2 = 0;
        cin >> n;
        for (int i = 0; i < n; i++)
        {
            cin >> a[i];
            if (a[i] == 10)
            {
                sum1++;
            }
            else
            {
                sum2++;
            }
        }
        if (sum1 > sum2)
        {
            cout << "10";
        }
        else
        {
            cout << "20";
        }
        return 0;
    }
    
    • 1
      @ 2023-10-6 17:04:47

      呵呵,本题的AC我笑纳了

      #include <bits/stdc++.h>
      using namespace std;
      int main(){
          int n,x,ans1=0,ans2=0;
          cin>>n;
          for(int i=1;i<=n;i++){
              cin>>x;
              if(x==10) ans1++;
              else ans2++;
          }
          cout<<((ans1>ans2)?"10":"20");
          return 0;
      }
      
      • 0
        @ 2023-1-25 12:28:45
        #include <iostream>
        using namespace std;
        int main()
        {
            int n,x,a=0,b=0;
            cin >> n;
            for(int i=1;i<=n;i++)
            {
                cin >> x;
                if(x==10)
                {
                    a++;
                }
                else
                {
                    b++;
                }
            }
            if(a>b)
            {
                cout << 10;
            }
            else
            {
                cout << 20;
            }
        }
        
        • 1

        信息

        ID
        804
        时间
        1000ms
        内存
        128MiB
        难度
        1
        标签
        递交数
        48
        已通过
        40
        上传者