ccc_ @ 2023-09-04 15:08:49
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int main(){
int n,i,j,k;
cin>>n;
double a[300],b,d,c;
for(i=0;i<n;i++){
cin>>b;
a[i]=b;
}
sort(a,a+n);
for(j=1;j<n-1;j++){
d+=a[j];
}
d=d/(n-2);
printf("%.2lf\n",d);
for(k=1;k<n-1;k++){
if(fabs(a[k]-d)>c) c=fabs(a[k]-d);
}
printf("%.2lf",c);
return 0;
}
by VIOLET__FOREVER @ 2023-09-06 10:24:05
@ccc_ 题目里要求的是用空格隔开,你这里是换行,求关