_jobdu_1001
/************************************************************************/
/* 题目描述:
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的更多相关文章
随机推荐
- 【转】SQL删除重复记录,只保留其中一条
SQL:删除重复数据,只保留一条用SQL语句,删除掉重复项只保留一条在几千条记录里,存在着些相同的记录,如何能用SQL语句,删除掉重复的呢 1.查找表中多余的重复记录,重复记录是根据单个字段(peop ...
- Java删除文件夹和文件
转载自:http://blog.163.com/wu_huiqiang@126/blog/static/3718162320091022103144516/ 以前在javaeye看到过关于Java操作 ...
- 多个list合并
需要多个list合并,如图 @SuppressWarnings("unchecked") @Override public List<CwInfo> get ...
- linux Xtrabackup安装及使用方法
[root@centos01 ~]# rpm -Uvh http://www.percona.com/downloads/percona-release/percona-release-0.0-1.x ...
- .net学习笔记----利用System.Drawing.Image类进行图片相关操作
C#中对图片的操作主要是通过System.Drawing.Image等类进行. 一.将图片转换为字节流 /// <summary> /// 图片处理帮助类 /// </summary ...
- WPF入口Application
1.WPF和 传统的WinForm 类似, WPF 同样需要一个 Application 来统领一些全局的行为和操作,并且每个 Domain (应用程序域)中只能有一个 Application 实例存 ...
- 2016"百度之星" - 初赛(Astar Round2A)
题目链接: http://bestcoder.hdu.edu.cn/contests/contest_show.php?cid=701 1001 : 矩阵快速幂 #include <iostre ...
- hdu 1150 Machine Schedule 最少点覆盖转化为最大匹配
Machine Schedule Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php? ...
- BZOJ 1821 JSOI2010 部落划分 Group prim
Description 聪聪研究发现,荒岛野人总是过着群居的生活,但是,并不是整个荒岛上的所有野人都属于同一个部落,野人们总是拉帮结派形成属于自己的部落,不同的部落之间则经常发生争斗.只是,这一切都成 ...
- Apache服务器的下载与安装
关于PHP的运行环境搭载,网上文章繁杂,遂自己整理一篇! PHP的运行必然少不了服务器的支持,何为服务器?通俗讲就是在一台计算机上,安装个服务器软件,这台计算机便可以称之为服务器,服务器软件和计算机本 ...