rqnoj 138 监考老师

rqnoj 138 监考老师
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 ;
}


你可能感兴趣的:(rqnoj 138 监考老师)