/************************************************************************/
/* 题目描述:
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. 使用ajax解决ie缓存问题

    1.在XMLHttpRequest/发送的请求之前 加上 XMLHttpRequest.setRequestHeader("If-Modified-Since","0&q ...

  2. 如何调试lua脚本

    首先感谢下ZeroBrane Studio. 这里拿cocos2dx/samples/Lua/HelloLua做例子来说明,其他的都是同样道理. 1.下载调试Lua所需的IDE,地址在这.有经济实力的 ...

  3. MySQL 全文搜索支持, mysql 5.6.4支持Innodb的全文检索和类memcache的nosql支持

    背景:搞个个人博客的全文搜索得用like啥的,现在mysql版本号已经大于5.6.4了也就支持了innodb的全文搜索了,刚查了下目前版本号都到MySQL Community Server 5.6.1 ...

  4. 【JAVA、C++】 LeetCode 008 String to Integer (atoi)

    Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. ...

  5. 1.前端笔记之html

    title: 1.前端笔记之HTML date: 2016-04-04 23:21:52 tags: Python categories: Python --- 作者:刘耀 **出处:http://w ...

  6. QQ图片名字

    ﻩ并亲了你一下ﻩ大兔子҉҉大兔子҉҉҉҉҉҉҉҉

  7. cf158B(水题)

    题意:1辆出租车可以坐4人,已知k组人每组ki(ki<=4)人去坐车,要求同组人坐同一辆车,求最少需多少辆车.. 4人组的单独算,1人组和3人组一起,如1多余再将1和2匹配即可.... 代码如下 ...

  8. 关于struts 2中的日期问题

    struts 2中引入了大量的jquery的内容 其中日期问题总结一下: 步骤: 1.当然不用说,先建一个web项目 2.导入struts2所需要的jar包,以及此插件的包(当然你也可以用:strut ...

  9. hdu 1806 rmq

    找到一个区间内出现最多的数的次数 10 3 //10个数字三次询问 -1 -1 1 1 1 1 3 10 10 10 2 3 1 10 5 10 0 143 #include<cstdio> ...

  10. View、ViewGroup (转)

    Android原理揭秘系列之View.ViewGroup (转) Android的UI界面都是由View和ViewGroup及其派生类组合而成的.其中,View是所有UI组件的基类,而ViewGrou ...