萌新求助,4RE1WA,能否看一下我的代码?谢谢大佬们了~

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

b累加的那层循环`i<n`应为`j<m`
by nonanalyzer @ 2020-10-28 19:15:13


@[Analyziz](/user/32195) 啊……[笑哭]but我还是只A了一个点啊……
by 小鸟飞飞飞 @ 2020-10-28 19:16:45


现在的代码: ```cpp #include <bits/stdc++.h> using namespace std; int main() { int n,m,a[10002]={}; double b=0,fen=0; cin >> n >> m; for (int i=1;i<=n;i++) { for (int j=1;j<=m;j++) { cin >> a[j]; } sort (a+1,a+m+1); for (int j=2;j<m;j++) { b+=a[j]; } b/=(m-2); if (b>=fen) { fen=b; } for (int j=1;j<=m;j++) { a[j]=0; } } printf ("%.2f",fen); return 0; } ```
by 小鸟飞飞飞 @ 2020-10-28 19:17:46


b没归零
by norcrow @ 2020-10-28 19:19:48


还有大数组放全局变量
by norcrow @ 2020-10-28 19:20:43


@[小鸟飞飞飞](/user/291838) b没清0
by nonanalyzer @ 2020-10-28 19:21:38


@[Boss_Yang](/user/418816) 10000个int没事
by nonanalyzer @ 2020-10-28 19:22:28


|