/(ㄒoㄒ)/~~ 为什么输入的次数没有n次 求各位dalao帮忙改一下!

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

本蒟蒻在这里谢谢各位dalao了 /(ㄒoㄒ)/~~
by baixiaoxiao @ 2022-08-05 09:44:20


@[baixiaoxiao](/user/763945) j 是这样写的?
by Trinitrotoluene @ 2022-08-05 09:46:36


定义全局变量
by Etinorally @ 2022-08-05 09:46:44


`` for (int j = i; j <= m; j++) //j应从1开始 `` 这里错了?
by dengyujie2020 @ 2022-08-05 09:46:47


哦,不对。是输入时应该是从一到m
by OIerBoy @ 2022-08-05 09:46:52


@[baixiaoxiao](/user/763945)
by OIerBoy @ 2022-08-05 09:47:02


而且j从1开始
by Etinorally @ 2022-08-05 09:47:07


@[Trinitrotoluene](/user/141555) j改一下就好了<捂脸
by baixiaoxiao @ 2022-08-05 09:48:18


我改的: ``` #include<bits/stdc++.h> int n, m, q[114514]; double total[114514]; using namespace std; int main() { cin >> n >> m; for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { cin >> q[j]; } sort(q+1,q+1+m); q[1] = 0; q[m] = 0; for (int k = 1; k < m; k++){ total[i] += q[k]; q[k] = 0; } total[i] /= (m-2); } sort(total+1,total+1+n); printf("%.2lf", total[n]); return 0; } ```
by OIerBoy @ 2022-08-05 09:48:39


@[baixiaoxiao](/user/763945) https://www.luogu.com.cn/record/82507647 好家伙,就改一下J 就行 ``` for (int j = 1; j <= m; j++) ``` 二维数组搞错了吧,都没输完整
by dengyujie2020 @ 2022-08-05 09:49:19


| 下一页