Glooda @ 2022-12-03 19:04:13
#include<bits/stdc++.h>
using namespace std;
int main(){
int b[114514],a;
double ans=0;
cin>>a;
for(int i=1;i<=a;i++){
cin>>b[i];
}
sort(b,b+a);
for(int i=1;i<=a;i++){
if(i==1||i==a){
ans=ans+0;
}
else ans=ans+b[i];
}
cout<<fixed<<setprecision(2)<<ans/(a-2);
return 0;
}
by jhdrgfj @ 2022-12-03 19:16:01
homo特有的无处不在
sort那行要改成sort(b+1,b+a+1)
因为你原来的代码只会给b[0]~b[a-1]排序
by Glooda @ 2022-12-04 13:35:31
@jhdrgfj
臭死测评机(雾 整好了,过了,谢谢大佬,下次数组开1919810(大喜