zhangtang007 @ 2020-10-07 22:56:06
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,m;int s[1005] = {0};
cin >> n;
if(n == 0) {
cout << 0<<endl;goto returnhere;}
for(int i = 0;i<n;++i){
cin >> s[i];
}
sort(s,s+n);
for(int i = 0;i < n;i++){
m += s[i];
}
m = m - s[n - 1] - s[0];
cout <<fixed<<setprecision(2)<<m/double(n-2) <<endl;
returnhere:
return 0;
}
by 做梦想Peach @ 2020-10-07 23:00:30
@zhangtang007蒟蒻
m
没初始化m/double (n-2)
改成m*1.0/(n-2)
by zhangtang007 @ 2020-10-07 23:05:04
好的,谢谢大佬。