BlueStar_zhjy @ 2022-12-18 11:25:46
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
double max,min,max_2;
double a[1001];
cin>>n;
for(int i=0;i<n;i++){
cin>>a[i];
}
sort(a,a+n);
max=a[0];
min=a[n-1];
max_2=a[1];
double sum=0;
for(int i=0;i<n;i++){
sum+=a[i];
}
sum=sum-max-min;
double pz,wc;
pz=sum/(n-2);
wc=fabs(max_2-pz);
cout<<fixed<<setprecision(2)<<pz<<" "<<wc;
return 0;
}
by Hongzixuan0922 @ 2022-12-18 11:56:21
max和min好像反了吧,sort不是从小到大吗