shangyuang @ 2022-10-05 08:27:03
#include<bits/stdc++.h>
using namespace std;
int s,n,maxn,minn;
int main(){
cin>>n;
for(int i=1;i<=n;i++){
int qwq;
cin>>qwq;
s+=qwq;
maxn=max(qwq,maxn);
minn=min(qwq,minn);
}
printf("%.2lf",1.0*(s-maxn-minn)/(n-2));
return 0;
}
c++的,第一个测试点WA掉了,求助
by 12345678hzx @ 2022-10-05 08:39:44
把maxn初值设为999999999。
by WZWZWZWY @ 2022-10-05 09:25:29
maxn设为负数,minn设为大于10的数就行了
@shangyuang
by kurumi_ @ 2022-10-05 09:35:41
maxn和minn没赋初值。
by shangyuang @ 2022-10-05 16:21:42
哦哦
by shangyuang @ 2022-10-05 16:24:14
@WZRYWZWY
by shangyuang @ 2022-10-05 16:26:03
A了,感谢各位 dalao 嘻嘻嘻