Find the row having the largest number of cribbers,and similarly find the rank.Adding two numbers up is okay.
Here is my code:
#include<iostream>
#include<string.h>
#define maxn 101
using namespace std;
long n,m,maxx,maxy,x[maxn],y[maxn];
bool r[maxn][maxn];
int main()
{
memset(x,0,sizeof(x));
memset(y,0,sizeof(y));
cin>>n>>m;
for(long i=1;i<=n;i++)
for(long j=1;j<=m;j++)
{
cin>>r[i][j];
if(r[i][j])
{
x[i]++;y[j]++;
}
}
// Input
maxx=maxy=0;
for(long i=1;i<=n;i++)
if(maxx<x[i])
maxx=x[i];
for(long i=1;i<=m;i++)
if(maxy<y[i])
maxy=y[i];
cout<<maxx+maxy<<endl;
return 0;
}
posted on 2010-09-27 22:39
lee1r 阅读(226)
评论(0) 编辑 收藏 引用 所属分类:
题目分类:基础/模拟