求助(玄关)

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

求关。 ```cpp #include<bits/stdc++.h> using namespace std; int main(){ long long n,m; double M=-1,sum=0; cin>>n>>m; for(int i=n;i>0;i--){ long long x,ma=-1,mi=11; sum=0; for(long long j=1;j<=m;j++){ cin>>x; ma=max(ma,x); mi=min(mi,x); sum+=x; } M=max(M,(sum-ma-mi)/(m-2)*1.00); } printf("%.2lf\n",M); return 0; } ```
by HuangSiHan3116 @ 2024-08-29 19:48:44


```cpp #include<bits/stdc++.h> using namespace std; int main(){ int n,m;//n表示n名同学参赛,m表示m名评委 cin>>n>>m; float r=-1;//最后要输出的分数 while(n--){ float t=0,mim=100,mam=-1,ans=0; float ans=0; for (int i=0;i<m; i++) { cin>>t; ans+=t; min=min(t,mim),mam=max(t,mam); } ans-=mim+mam; ans/=m-2.0; r=max(ans,r); } printf("%.2f",r); return 0; } ```
by zhanghengrui0502 @ 2024-08-29 19:50:55


AC代码,求关~~
by zhanghengrui0502 @ 2024-08-29 19:51:26


就没人能帮我改改吗
by xiaojuzia @ 2024-08-29 19:51:28


呃……你的变量名有问题(自己想想)
by zhanghengrui0502 @ 2024-08-29 19:52:39


@[xiaojuzia](/user/1053192) 正在帮你改。
by HuangSiHan3116 @ 2024-08-29 19:52:58


@[HuangSiHan3116](/user/1355829) @[zhanghengrui0502](/user/991554) 感谢
by xiaojuzia @ 2024-08-29 19:53:43


```cpp #include<bits/stdc++.h> using namespace std; int a[105][25]; int main() { int n,m; cin>>n>>m; for(int i = 0 ; i < n ; i++) { for(int j = 0 ; j < m ; j++) { cin>>a[i][j]; } } double sb[105]; for(int i = 0 ; i < n ; i++) { sort(a[i],a[i]+m); } for(int i = 0 ; i < n ; i++) { for(int j = 1 ; j < m - 1 ; j++) { sb[i]+=1.0*a[i][j]; } sb[i]/=(m-2); } sort(sb,sb+n); sb[n-1]=sb[n-1]; printf("%.2lf",sb[n-1]); return 0; } ```
by 奈芙蓮 @ 2024-08-29 19:57:56


@[奈芙蓮](/user/1293516) 感谢
by xiaojuzia @ 2024-08-29 20:00:37


|