求助
  • 板块学术版
  • 楼主Elliott19
  • 当前回复9
  • 已保存回复9
  • 发布时间2022/11/16 20:25
  • 上次更新2023/10/27 02:44:43
查看原帖
求助
773155
Elliott19楼主2022/11/16 20:25
#include<bits/stdc++.h>
using namespace std;
int a[5100][5100];
int xy[5100][3]; 
int main()
{
	long long n,r=0,num=0,maxx=0;
	cin>>n;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
		{
			cin>>a[i][j];
			if(a[i][j]==0)r++,xy[++num][1]=i,xy[num][2]=j;
		}
	if(r==0)
		cout<<"Bad Game!";
	else
	{
		for(int i=1;i<=num;i++)
		{
			int s=0,x=xy[i][1],y=xy[i][2];
			for(int j=1;j<=n;j++)s+=a[x][j],s+=a[j][y];
			maxx=max(s,int(maxx));
		}
		cout<<maxx;
	}
	return 0;
}

#2 #4 #6 #7 #7 #8 RE求助!

2022/11/16 20:25
加载中...