求助大佬,40分QAQ

P5738 【深基7.例4】歌唱比赛

@[qichuanyi](/user/1018548) `double v = a[n] / (m - 2) * 1.00;` 改为 `double v = a[n] / (m - 2.00);`
by dongzirui0817 @ 2024-08-28 11:02:35


@[qichuanyi](/user/1018548) ```cpp int n,m,a[1001],maxn[1001] = {INT_MIN},minn[1001] = {INT_MAX}; ``` 你这个初始化方式有问题,这样初始化它只有第一个元素(`maxn[0]`)是 `INT_MIN`,其余的全是 $0$。另一个数组同理: ```cpp #include<bits/stdc++.h> using namespace std; int n, m, a[1001], maxn[1001], minn[1001]; int main() { cin >> n >> m; memset(maxn, -0x3f, sizeof maxn); memset(minn, 0x3f, sizeof minn); for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { int w; cin >> w; a[i] += w; maxn[i] = max(maxn[i], w); minn[i] = min(minn[i], w); } a[i] -= maxn[i] + minn[i]; } sort(a + 1, a + 1 + n); double v = (a[n] + 0.0) / (m - 2.0); printf("%.2f", v); return 0; } ```
by GXZJQ @ 2024-08-28 11:10:02


@[dongzirui0817](/user/905593) 这样只有 20 pts: <https://www.luogu.com.cn/record/175069539>
by GXZJQ @ 2024-08-28 11:11:18


感谢大佬指点
by luogu_avatar @ 2024-08-28 11:29:54


都给你们两个大佬关注了
by luogu_avatar @ 2024-08-28 11:37:21


|