蒟蒻求调

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

@[100WINNER](/user/1270248) 你数组和变量重名了
by Miracles_ @ 2024-08-20 19:29:56


@[100WINNER](/user/1270248) 还有,cin和scanf不要混用 ```cpp #include <bits/stdc++.h> using namespace std; int n,m,b; int p[110]; int main(){ cin>>n>>m; double a = 0,b2 = 0,c = 0; b = m - 2; for(int i = 1;i <= n;i++){ for(int j = 1;j <= m;j++) cin>>p[j]; sort(p + 1,p + 1 + m); for(int sum = 2;sum < m;sum++) b2 += p[sum]; a = b2 / b; if(a > c) c = a; a = 0; b2 = 0; } cout <<fixed<<setprecision(2)<<c; return 0; } ```
by wwwwwza @ 2024-08-20 19:31:36


@[wwwwwza](/user/559526) 已关注,**感谢!**
by 100WINNER @ 2024-08-21 09:07:16


@[Miracles_](/user/1300324) 已关注,感谢 结帖
by 100WINNER @ 2024-08-21 09:08:01


|