心如止水
Je n'ai pas le temps
posts - 400,comments - 130,trackbacks - 0
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 阅读(206) 评论(0)  编辑 收藏 引用 所属分类: 题目分类:基础/模拟

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理