Submission

Status:

PPPPPPPPPPPPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: cheetah

Problemset: RANGEandMEAN

Language: cpp

Time: 0.002 second

Submitted On: 2026-06-04 00:10:35

#include <bits/stdc++.h>
using namespace std;

int main () {
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int n;
    cin >> n;
    int ar[n];
    float cnt = 0;

    for (int i = 0; i < n; ++i) {
        cin >> ar[i];
        cnt += ar[i];
    }
    sort(ar, ar + n);

    if (ar[0] < 0 and ar[n - 1] < 0) {
        cout << -1 * (ar[0] - ar[n - 1]) << " ";
    }
    else if (ar[0] < 0) {
        cout << (-1 * ar[0]) + ar[n - 1] << " ";
    }
    else {
        cout << ar[n - 1] - ar[0] << " ";
    }

    cout << fixed << setprecision(2) << cnt / n;
    
    return 0;
}