6 条题解

  • 1
    @ 2023-10-12 23:55:03

    纯属闲的

    #include<bits/stdc++.h>
    using namespace std;
    int a[15];
    bool cmp(int a,int b)
    {
        return a>b;
    }
    int main()
    {
        for(int i=0;i<5;i++)
        {
            cin>>a[i];
        }
        sort(a,a+5,cmp);
        cout<<max(a[0],a[4])<<" "<<min(a[0],a[4]);
    //应题目要求写的max和min,将代码复杂化
        return 0;
    }
    
    • 1
      @ 2023-1-9 22:38:24

      用函数,不迷路!

      #include <bits/stdc++.h>
      using namespace std;
      int main()
      {
          int a, b, c, d, e;
          cin >> a >> b >> c >> d >> e;
          cout << max(a, max(b, max(c, max(d, e))));
          cout << ' ' << min(a, min(b, min(c, min(d, e))));
          return 0;
      }
      
      • 0
        @ 2024-1-21 11:01:45

        哪里有问题?

        #include <iostream>
        using namespace std;
        int main()//头文件
        {
            int a[5],maxx=0,minn=100;
            for (int i=0;i<5;i++)
            {
                cin >> a[i];
                if (a[i]<minn)
                {
                    minn=a[i];
                }
                if (a[i]>maxx)
                {
                    maxx=a[i];
                }
            }
            cout << maxx << ' ' << minn;
            return 0;//结尾
        }
        
        • 0
          @ 2023-9-22 18:33:28
          #include<bits/stdc++.h>
          using namespace std;
          int main()
          {
              int a , b , c , d , e;
              cin >> a >> b >> c >> d >> e;
              cout << max(a , max(b,max(c , max(d,e) ))) << " ";
              cout << min(a , min(b,min(c , min(d,e) ))) << " ";
              return 0;
          }//A
          
          • 0
            @ 2023-4-5 17:35:25

            用(一点也不)神奇的数组

            #include<bits/stdc++.h>
            using namespace std;
            int a[7];
            int main()
            {
                for (int i=1;i<=5;i++)
                    cin>>a[i];
                sort(a+1,a+6);
                cout<<a[5]<<' '<<a[1];
                return 0;
            }
            • 0
              @ 2023-1-15 11:17:30
              #include <iostream>//hetao3097453
              #include <algorithm>
              using namespace std;
              int main()
              {
                  int a,b,c,d,e;
                  cin >> a >> b >> c >> d >> e;
                  int maxx = max(a, max(b, max(c, max(d, e))));
                  int minn = min(a, min(b, min(c, min(d, e))));
                  cout << maxx << " " << minn;
                  return 0;
              }
              
              
              • 1

              信息

              ID
              636
              时间
              1000ms
              内存
              16MiB
              难度
              5
              标签
              递交数
              201
              已通过
              80
              上传者