2 条题解

  • 2
    @ 2022-12-16 20:06:10

    其实,还是简单的,L6

    #include <iostream>//hetao3097453
    using namespace std;
    int a[1001];
    int main()
    {
        int n,maxx = -1,minn = 9999;
        cin >> n;
        for(int i = 1;i <= n;i++)
        {
            cin >> a[i];
        }
        for(int i = 1;i <= n;i++)
        {
            maxx = max(maxx,a[i]);
        }
        for(int i = 1;i <= n;i++)
        {
            minn = min(minn,a[i]);
        }
        for(int i = 1;i <= n;i++)
        {
            if(a[i] == maxx)
            {
                a[i] *= 2;
            }
            if(a[i] == minn)
            {
                a[i] += 1;
            }
        }
        for(int i = 1;i <= n;i++)
        {
            cout << a[i] << " ";
        }
        return 0;
    }
    
    
    • 0
      @ 2024-1-30 16:36:37
      #include <bits/stdc++.h>
      using namespace std;
      int a[1001];
      int main()
      {
          int n,maxx = -1,minn = 9999;
          cin >> n;
          for(int i = 1;i <= n;i++)
          {
              cin >> a[i];
          }
          for(int i = 1;i <= n;i++)
          {
              maxx = max(maxx,a[i]);
          }
          for(int i = 1;i <= n;i++)
          {
              minn = min(minn,a[i]);
          }
          for(int i = 1;i <= n;i++)
          {
              if(a[i] == maxx)
              {
                  a[i] *= 2;
              }
              if(a[i] == minn)
              {
                  a[i] += 1;
              }
          }
          for(int i = 1;i <= n;i++)
          {
              cout << a[i] << " ";
          }
          return 0;
      }
      
      • 1

      信息

      ID
      580
      时间
      1000ms
      内存
      128MiB
      难度
      1
      标签
      递交数
      65
      已通过
      45
      上传者