chenjunhui @ 2024-11-14 10:46:14
#include<iostream>
using namespace std;
int main()
{double a,n,min=10000,max=-1,sum=0;
double g;
cin>>n;
for(int i=1;i<=n;i++)
{cin>>a;
if(a>max)
max=a;
if(a<min)
min=a;
sum=sum+a; }
g=(sum-min-max)/(n-2);
cout<<g;
return 0;}
by Fiendish @ 2024-11-14 10:59:18
#include<iostream>
using namespace std;
int main()
{double a,n,min=10000,max=-1,sum=0;
double g;
cin>>n;
for(int i=1;i<=n;i++)
{cin>>a;
if(a>max)
max=a;
if(a<min)
min=a;
sum=sum+a; }
g=(sum-min-max)/(n-2);
printf("%.2lf",g);
return 0;}
@chenjunhui
by Fiendish @ 2024-11-14 10:59:50
题目要求保留两位小数