/************************************************************************/
/* 题目描述:
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. js指定标签的id只能添加不能删除

    <body> <form id="form1" runat="server"> <div> <input id=&qu ...

  2. Android 向Application对象添加Activity监听

    可以建立对象把Application.ActivityLifecycleCallbacks接口中的函数实现,并利用public void registerActivityLifecycleCallba ...

  3. Android 中的code sign

    Android 中和ios中都有code sign.它们的目的一样,都是要保证程序的可靠性,最基本实现原理也一样.但是sign的过程比较不同. 下面记录一点Android sign的重要知识. 请参看 ...

  4. redis 初探

    2014年6月24日 17:50:57 解压redis后进入源码目录,只用执行make命令就可以完成安装了 安装完成后到src目录里,将 redis-server redis-cli redis.co ...

  5. DisJSet:食物链(POJ 1182)

           动物王国的食物链 这一题有两种思路,先介绍第一种: 题目是中文的,我就不翻译了,也很好理解,就是一个A-B-C-A的一个循环的食物链,给定一些条件,问你哪些条件是错的 这一题,是一道比较 ...

  6. HDU5072 容斥原理

    G - Coprime Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit ...

  7. iOS通过设置info.plist参数使用iTunes导入导出Documents目录下的文件

    参考网址: http://my.oschina.net/hmj/blog/112592 http://www.cnblogs.com/taintain1984/archive/2013/05/27/3 ...

  8. Rational Rose2007(v7.0)下载地址、安装及激活详解教程(图)

    http://blog.csdn.net/skl_tz/article/details/8925152 最近需要画uml图,之前用的是Rose 2003版的,由于好久没进去了,结果发现原来的激活又失效 ...

  9. ubuntu下简单的驱动编译

    转自:http://www.eefocus.com/jefby1990/blog/13-02/291628_c39b8.html 本文是参考了网上多篇帖子而写的算不上什么原创.唯一值得欣慰的只不过在本 ...

  10. struts2框架——从后台取得数据集,并在前台页面循环显示

    1.CourseBean.java public class CourseBean { private String f_courseId = ""; private String ...