求助,必回关!!!

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

```cpp #include <bits/stdc++.h> using namespace std; int main() { int n,m,m2,x; double maxx=-999999; cin>>n>>m; m2=m-2; for(int i=1;i<=n;i++) { int maxn=-999999,minn=999999; double sum=0; for(int j=1;j<=m;j++) { cin>>x; if(x>maxn) maxn=x; if(x<minn) minn=x; sum+=x; } sum-=maxn; sum-=minn; sum/=m2; maxx=max(sum,maxx); } printf("%.2lf",maxx); return 0; } ```
by 奈芙蓮 @ 2024-08-28 14:50:46


``` #include <bits/stdc++.h> using namespace std; int main() { int n,m,x,maxn=-999999,minn=999999; double m2,sum=0,maxx=-999999; cin>>n>>m; m2=m-2; for(int i=1;i<=n;i++) { for(int j=1;j<=m;j++) { cin>>x; if(x>maxn) maxn=x; if(x<minn) minn=x; sum+=x; } sum-=maxn; sum-=minn; sum/=m2; maxx=max(sum,maxx); maxn=-999999,minn=999999,sum=0; } printf("%.2lf",maxx); return 0; } ```
by zhangrui2023 @ 2024-08-28 14:55:25


```cpp #include<bits/stdc++.h> using namespace std; int main() { double maxx=0,b[10000]; int n,m,min,max,sum,i,j,a[10000][10000]; scanf("%d%d",&n,&m); for(i=1;i<=n;i++) { min=10,max=0;sum=0; for(j=1; j<=m; j++) { scanf("%d",&a[i][j]); if(min>a[i][j]) min=a[i][j]; if(max<a[i][j]) max=a[i][j]; sum+=a[i][j]; } b[i]=(double)(sum-min-max)/(double)(m-2); } for(i=1;i<=n;i++) if(maxx<b[i]) maxx=b[i]; printf("%.2lf",maxx); return 0; } ``` @[mayiteng123456](/user/1109386) 求关qwq
by Dress @ 2024-08-28 15:00:13


感谢各位,都关注了
by mayiteng123456 @ 2024-08-28 15:03:04


|