/************************************************************************/
/* 题目描述:
This time, you are supposed to find A+B where A and B are two matrices, and then count the number of zero rows and columns.
输入:
The input consists of several test cases, each starts with a pair of positive integers M and N (≤10) which are the number of rows and columns of the matrices, respectively. Then 2*M lines follow, each contains N integers in [-100, 100], separated by a space. The first M lines correspond to the elements of A and the second M lines to that of B.
The input is terminated by a zero M and that case must NOT be processed.
输出:
For each test case you should output in one line the total number of zero rows and columns of A+B.
样例输入:
2 2
1 1
1 1
-1 -1
10 9
2 3
1 2 3
4 5 6
-1 -2 -3
-4 -5 -6
0
样例输出:
1
5 */
/************************************************************************/
#include <iostream>
using namespace std;
//#define MAXCOL 10
//#define MAXINT 100
//#define MININT -100 int main()
{
short arr[][];
short m, n;
while((cin>>m),m)
{
cin>>n;
short i,j,temp,count;
for(i=;i<m;i++)
for(j=;j<n;j++)
cin>>arr[i][j];
for(i=;i<m;i++)
for(j=;j<n;j++)
{
cin>>temp;
arr[i][j]+=temp;
}
i = j = temp = count = ;
for(i=; i<m; i++)
{
temp = ;
for(j=; j<n; j++)
temp += arr[i][j];
if(!temp)count++;
}
for(j=; j<n; j++)
{
temp = ;
for(i=; i<m; i++)
temp += arr[i][j];
if(!temp)count++;
}
cout<<count<<endl;
}
}

_jobdu_1001的更多相关文章

随机推荐

  1. ZOJ 2315

    ---恢复内容开始--- http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1315 这个题目比较难以看懂,我也是看网上的题目意思才 ...

  2. 基于Delphi的三层数据库系统的实现方法

    基于Delphi的三层数据库系统的实现方法   1  引言 当前的数据库应用系统中,按其结构划分为两类,一类是两层结构的数据库应系统,另一类是多层结构的数据库应用系统. 两层结构的数据库应用系统包括客 ...

  3. dbVisualizer破解

    下载dbvis.puk,替换C:\Program Files\DbVisualizer\lib\dbvis.jar中的文件. 替换后打开选手动的key:下载地址dbvis.license

  4. Paths on a Grid(poj 1942)

    给定一个矩形网格的长m和高n,其中m和n都是unsigned int32类型,一格代表一个单位,就是一步,求从左下角到右上角有多少种走法,每步只能向上或者向右走. //注意循环的时候,要循环小的数,否 ...

  5. Repairing Company(poj 3216)

    题目大意: 有Q个地点,告诉你Q个地点之间的相互距离(从i地点赶到j地点需要的时间).有M项任务, 给你M项任务所在的地点block.开始时间start和任务完成需要时间time.一个工人只有在 他准 ...

  6. 集群管理 secondaryNameNode和NameNode(转)

    为了达到以下负责均衡,需要调整以下 改变负载 三台机器,改变负载 host2(NameNode.DataNode.TaskTracker) host6(SecondaryNameNode.DataNo ...

  7. oracle体系结构详细示意图

  8. 我与C++的不解情缘

    我是一个老实人,我当时报考C++真的全心是为了自己自考的免考,绝不是为了什么二级证,可是,进行到一半的时候,突然获悉,C++自我们这次开始,不作为免考科目了,当时我的心里啊,那个纠结,那个痛啊,随后, ...

  9. 在MSSQL中对ACCESS文件操作方式汇总

    CSDN朋友问题回复: 有个ACCESS数据库文件在本机,机器上的OFFICE套件已经卸载,ACCESS没有用户名和密码,如何用MSSQLServer来查询和修改其文件内容? 比如ACCESS物理文件 ...

  10. BEGIN TRAN...COMMIT TRAN 意思与用法

    BEGIN TRAN标记事务开始 COMMIT TRAN 提交事务 一般把DML语句(select ,delete,update,insert语句)放在BEGIN TRAN...COMMIT TRAN ...