文件目录

#include <iostream>
#include <cmath>
using namespace std;
int main()
{
    int n;
    cin >> n;
    double f[350] = {};
    int maxf = 0, minf = 0;
    double sumf = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> f[i];
        sumf += f[i];
        if (f[i] > f[maxf])
            maxf = i;
        if (f[i] < f[minf])
            minf = i;
    }
    double ave = (sumf - f[maxf] - f[minf]) / (n - 2);
    f[maxf] = f[minf] = ave;
    double maxave = 0;
    for (int i = 0; i < n; i++)
    {
        maxave = max(maxave, abs(f[i] - ave));
    }
    printf("%.2lf %.2lf", ave, maxave);
    return 0;
}