1 条题解

  • 0
    @ 2024-9-25 17:14:17

    参考答案:

    #include<iostream>
    using namespace std;
    const int N = 100010;
    int a[N];
    int main() 
    {
        int n;
        int maxx = -10000000, minn = 10000000;
        cin >> n;
        for (int i = 0; i < n; i++) 
        {
            cin >> a[i];
            if (a[i] > maxx) 
            {
                maxx = a[i];
            }
            if (a[i] < minn) 
            {
                minn = a[i];
            }
        }
        int res = maxx - minn;
        cout << res << endl;
        return 0;
    }
    
    • 1

    信息

    ID
    5381
    时间
    1000ms
    内存
    256MiB
    难度
    1
    标签
    递交数
    24
    已通过
    5
    上传者