xuehaojisaunji @ 2024-03-02 20:59:56
#include<bits/stdc++.h>
using namespace std;
int main(){
int a;
double b[520],d=0,x=10000,s=0,t,sx=10000,sd=0;
cin>>a;
for (int i=1;i<=a;i++)
{cin>>b[i];
s+=b[i];
d=b[i]>d?b[i]:d;
x=b[i]<x?b[i]:x;
}
for (int i=1;i<=a;i++)sd=(sd<=b[i]&&b[i]<d)?b[i]:sd;
for (int i=1;i<=a;i++)sx=(sx>=b[i]&&b[i]>x)?b[i]:sx;
s=s-d-x;
t=s/(a-2);
cout<<fixed<<setprecision(2)<<t<<" "<<(abs(t-sd)>abs(t-sx)?abs(t-sd):abs(t-sx));
return 0;
}