DreamGeorgeNotFound @ 2022-10-11 18:51:34
#include<iostream>
#include<cmath>
using namespace std;
int main(){
int n,a[1000],max=-1,min=11;
cin>>n;
for(int i=0;i<n;i++){
cin>>a[i];
if(a[i]>max){
max=a[i];
}
if(a[i]<min){
min=a[i];
}
}
int sum=0;
for(int i=0;i<n;i++){
sum+=a[i];
}
sum=sum-min-max;
sum/=n;
cout<<sum;
return 0;
}
by AC_CSP @ 2022-10-11 19:02:07
sum/=n;
by Jerrycyx @ 2022-10-11 19:23:43
@GorgeNotFound sum/=n
=> sum/=(n-2)
by DreamGeorgeNotFound @ 2022-10-11 21:07:05
@Jerrycyx 哦,谢谢,没发现
by DreamGeorgeNotFound @ 2022-10-11 21:22:26
@Jerrycyx 还是不行啊
by Voltaris @ 2023-06-11 11:49:58
printf("%.2lf",ans/(n-2)); 保留两位小数