@[chenqile](/user/953664) 仔细读题,他让你保留**两位**小数。
by xiaoshumiao @ 2023-12-22 19:24:59
```cpp
#include <bits/stdc++.h>
using namespace std;
int main(){
double a[1002],sum = 0;
int n;
cin>>n;
for (int i = 0; i < n; i++) cin>>a[i];
sort(a, a + n);
for (int i = 1; i < n - 1; i++) sum += a[i];
printf("%.2lf", sum/(n-2));
return 0;
}
```
by 7The_shy @ 2023-12-22 19:27:21
怎么还是ce
by chenqile @ 2023-12-22 19:28:45
1.n不能为double
2.输出的时候n应该减去两人
3.保留两位应该是“%.2lf”
by 7The_shy @ 2023-12-22 19:28:56
@[chenqile](/user/953664) ?IDE 上没有 CE。
by xiaoshumiao @ 2023-12-22 19:29:34
@[7The_shy](/user/890344) 不过 n 硬要开 double 也没事。
by xiaoshumiao @ 2023-12-22 19:30:23
不过本地会报错
by 7The_shy @ 2023-12-22 19:31:12
THANKS EVERYBODY
我赏1个关注
by chenqile @ 2023-12-22 19:34:35