wjb2304 @ 2024-10-05 10:20:11
#include<bits/stdc++.h>
using namespace std;
double a[305];
int main(){
int n;
double x,s=0;;
cin >>n;
for (int i=1;i<=n;i++) cin >>a[i];
sort(a+1,a+1+n);
for (int i=1;i<=n;i++){
s+=a[i];
}
s=s-a[1]-a[n];
s=s/(n-2);
printf("%.2lf ",1.0*s);
int max=a[2];
for(int i=2;i<n;i++){
if(abs(a[i]-s)>max)
max=abs(a[i]-s);
}
printf("%.2lf",max);
return 0;
}```
by MAXCYP @ 2024-10-05 10:21:50
@wjb2304 你给我删了?
by liujunyi1234 @ 2024-10-05 10:32:41
@wjb2304
第16行:
double max=-1;
by liujunyi1234 @ 2024-10-05 10:34:58
@wjb2304
这样写能AC
by wjb2304 @ 2024-10-05 11:50:22
@liujunyi1234 谢谢