CFF_ZYL @ 2023-01-08 21:09:07
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
double tmp[5005],maxi=-9999,minn=9999,sum=0,sum1,maxd=-9999;
cin>>n;
for(int i=0;i<n;i++){
cin>>tmp[i];
sum+=tmp[i];
maxi=max(tmp[i],maxi);
minn=min(tmp[i],minn);
}
sum1=sum-maxi-minn;
cout<<fixed<<setprecision(2)<<sum1/(n-2)<<' ';
for(int i=0;i<n;i++){
if(tmp[i]!=maxi&&tmp[i]!=minn){
maxd=max(maxd,fabs(tmp[i]-sum1/(n-2)));
}
}
cout<<fixed<<setprecision(2)<<maxd;
return 0;
}
by keda2761 @ 2023-01-09 19:44:48
谁能帮我啊?
by kkkfc0114514 @ 2023-02-20 16:52:21
有个好东西叫做abs绝对值函数
abs(a)
懂?