zhubaot @ 2023-01-05 13:20:20
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int n,a[11];
double s;
int main(){
cin>>n;
for(int i=1;i<=n;i++)cin>>a[i];
sort(a+1,a+n+1);
for(int i=2;i<n;i++){
s+=a[i];
}
printf("%.2lf",s/(n-2));
return 0;
}
by zhubaot @ 2023-01-05 13:22:09
2、3wa,5re
by Kevin_Mamba @ 2023-01-05 13:24:46
@zhubaot 数组开小了。
by WA_sir @ 2023-01-05 13:24:54
@zhubaot
by Kevin_Mamba @ 2023-01-05 13:25:09
n\le 1000
by Alone_Moonking @ 2023-01-05 13:41:31
@zhubaot
#include<bits/stdc++.h>
using namespace std;
float n,a[1020];
int maxn=-1,minn=11;
int main()
{
cin>>n;
int ans=0;
for(int i=1;i<=n;i++)
{
cin>>a[i];
ans+=a[i];
if(a[i]>maxn)
{
maxn=a[i];
}
if(a[i]<minn)
{
minn=a[i];
}
}
cout<<fixed<<setprecision(2)<<(ans-maxn-minn)/(n-2);
}
by jomy @ 2023-01-05 13:49:35
直接给他上代码不太好吧!
by zhubaot @ 2023-01-05 14:01:58
@2124Kobe @WA_sir OK,现在好了
by zhubaot @ 2023-01-05 14:02:35
@jomy2013 all right