AIMEE11 @ 2022-08-03 10:55:08
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,i,sum=0,min=11,s=0;
cin>>n;
for(int a=0;a<n;a++)
{
cin>>i;
if(sum<i)
sum=i;
if(min>i)
min=i;
s+=i;
}
s=s-min-sum;
printf("%.2lf",s/(n-2));
return 0;
}
在线蹲dalao
by 陈总 @ 2022-08-03 11:03:06
把
int n,i,sum=0,min=11,s=0;
改为
double n,i,sum=0,min=11,s=0;
by ajahjahah @ 2022-08-03 11:04:37
by AIMEE11 @ 2022-08-03 11:15:43
谢谢啦
by PixelTime @ 2022-09-16 16:20:47
int
设为 double
by wch666 @ 2023-01-05 19:56:24
#include<bits/stdc++.h>
using namespace std;
int b=0,d=2100000000,c,f[1000];
double a=0;
int main()
{
cin>>c;
for(int i=0; i<c; i++)
{
cin>>f[i];
if(f[i]>b)
{
b=f[i];
}
if(f[i]<d)
{
d=f[i];
}
a+=f[i];
}
a=a-b-d;
a=a*1.00/(c-2)*1.00;
printf("%.2f",a);
return 0;
}