60分求助 #2#3WA
查看原帖
60分求助 #2#3WA
196318
ITProgrammer楼主2021/9/4 21:15

RT,本地样例测试通过,请大佬指正

#include <bits/stdc++.h>
using namespace std;
int a[101][21];
int n,m;
int main()
{
	cin>>n>>m;
	double ans=0.0;
	for(int i=1;i<=n;i++)
	{
		int maxn=INT_MIN,minn=INT_MAX,tot=0;
		for(int j=1;j<=m;j++)
		{
			cin>>a[i][j];
			tot+=a[i][j];
			if(a[i][j]>maxn)
				maxn=a[i][j];
			if(a[i][j]<minn)
				minn=a[i][j];
		}
		tot=tot-maxn-minn;
		tot=tot*1.0/(m-2);
		if(tot>ans)
			ans=tot;
	}
	cout<<fixed<<setprecision(2)<<ans<<endl;
	return 0;
}
2021/9/4 21:15
加载中...