soultrap @ 2023-07-11 13:37:46
逝了很多次,都是WA!!!
by winner_0207_AFO @ 2023-07-11 13:44:37
c++
#include<bits/stdc++.h>
using namespace std;
double a[100005];
int main(){
int n;
cin>>n;
double max,min,s,e = 0;
int maxn,minn;
for(int i = 0;i < n;i++){
cin>>a[i];
if(i==0){
max = a[0];
min = a[0];
}else{
if(a[i]>max){
max = a[i];
maxn = i;
}
if(a[i] < min){
min = a[i];
minn = i;
}
}
s += a[i];
}
s = 1.0 * (s - max - min) / (n - 2);
for(int i = 0;i < n;i++){
if(i == maxn || i == minn) continue;
if(fabs(a[i] - s) > e) e = fabs(a[i] - s);
}
printf("%.2lf %.2lf\n",s,e);
return 0;
}
你要不要吧!
by soultrap @ 2023-07-11 13:46:17
@NBxzz2012 感谢你一百年
by winner_0207_AFO @ 2023-07-11 14:20:36
姬霓太美