2 条题解

  • 1
    @ 2023-9-24 10:37:46
    #include <bits/stdc++.h>
    using namespace std;
    struct student
    {
        int id, v;
    }a[105];
    int main()
    {
        int n;
        double ans = 0;
        cin >> n;
        for (int i = 1; i <= n; i++)
        {
            cin >> a[i].id >> a[i].v;
            ans += a[i].v;
        }
        ans /= n;
        for (int i = 1; i <= n; i++)
        {
            if (a[i].v - 10 >= ans)
                cout << a[i].id << " " << a[i].v << " A" << endl;
            else if (a[i].v + 10 <= ans)
                cout << a[i].id << " " << a[i].v << " C" << endl;
            else
                cout << a[i].id << " " << a[i].v << " B" << endl;
        }
        return 0;
    }
    
    • 0
      @ 2023-1-24 18:11:52
      #include <iostream>
      using namespace std;
      int main()
      {
          int n,a[105],b[105];
          double sum=0,d;
          cin >> n;
          for(int i=1;i<=n;i++)
          {
              cin >> a[i];
              cin >> b[a[i]];
              sum+=b[a[i]];
          }
          d=sum/n;
          for(int i=1;i<=n;i++)
          {
              cout << i << " " << b[i] << " ";
              if(b[i]-d>=10)
              {
                  cout << "A" << endl;
              }
              else if(d-b[i]>=10)
              {
                  cout << "C" << endl;
              }
              else
              {
                  cout << "B" << endl;
              }
          }
      }
      
      • 1

      信息

      ID
      1021
      时间
      1000ms
      内存
      128MiB
      难度
      4
      标签
      递交数
      24
      已通过
      16
      上传者