九度oj 1001 A+B for Matrices 2011年浙江大学计算机及软件工程研究生机试真题
题目1001:A+B for Matrices
时间限制:1 秒
内存限制:32 兆
特殊判题:否
提交:15235
解决:6172
- 题目描述:
-
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
- 2 2
- 样例输出:
-
- 1
- 5
- 1
- 来源:
- 2011年浙江大学计算机及软件工程研究生机试真题
- 分析:
- 读懂题意就OK
- #include<iostream>
- #include<queue>
- #include<cstdio>
- #include<cstring>
- #include<cmath>
- #include<algorithm>
- using namespace std;
- int map[][];
- int main(){
- int m,n;
- while(scanf("%d",&m)&&m){
- scanf("%d",&n);
- int i,j;
- for(i=;i<m;i++){
- for(j=;j<n;j++){
- scanf("%d",&map[i][j]);
- }
- }
- for(i=;i<m;i++){
- for(j=;j<n;j++){
- int t;
- scanf("%d",&t);
- map[i][j]+=t;
- }
- }
- int sum=;
- for(i=;i<m;i++){
- for(j=;j<n;j++){
- if(map[i][j])
- break;
- }
- if(j==n)
- sum++;
- }
- for(i=;i<n;i++){
- for(j=;j<m;j++){
- if(map[j][i])
- break;
- }
- if(j==m)
- sum++;
- }
- cout<<sum<<endl;
- }
- return ;
- }
九度oj 1001 A+B for Matrices 2011年浙江大学计算机及软件工程研究生机试真题的更多相关文章
- 九度oj 1464 Hello World for U 2012年浙江大学计算机及软件工程研究生机试真题
题目1464:Hello World for U 时间限制:1 秒 内存限制:128 兆 特殊判题:否 提交:3872 解决:1082 题目描述: Given any string of N (> ...
- 九度oj 1004 Median 2011年浙江大学计算机及软件工程研究生机试真题
题目1004:Median 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:14162 解决:3887 题目描述: Given an increasing sequence S of N i ...
- 九度oj 1002 Grading 2011年浙江大学计算机及软件工程研究生机试真题
#include<iostream> #include<queue> #include<cstdio> #include<cstring> #inclu ...
- 九度OJ 1019 简单计算器 -- 2006年浙江大学计算机及软件工程研究生机试真题
题目地址:http://ac.jobdu.com/problem.php?pid=1019 题目描述: 读入一个只包含 +, -, *, / 的非负整数计算表达式,计算该表达式的值. 输入: ...
- 九度oj 1034 寻找大富翁 2009年浙江大学计算机及软件工程研究生机试真题
题目1034:寻找大富翁 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:5323 解决:2123 题目描述: 浙江桐乡乌镇共有n个人,请找出该镇上的前m个大富翁. 输入: ...
- 九度oj 1031 xxx定律 2009年浙江大学计算机及软件工程研究生机试真题
题目1031:xxx定律 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:5153 解决:3298 题目描述: 对于一个数n,如果是偶数,就把n砍掉一半:如果是奇数,把n变成 3*n ...
- 九度oj 1032 ZOJ 2009年浙江大学计算机及软件工程研究生机试真题
题目1032:ZOJ 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:4102 解决:2277 题目描述: 读入一个字符串,字符串中包含ZOJ三个字符,个数不一定相等,按ZOJ的顺序输出,当 ...
- 九度oj 1006 ZOJ问题 2010年浙江大学计算机及软件工程研究生机试真题
题目1006:ZOJ问题 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:16244 解决:2742 题目描述: 对给定的字符串(只包含'z','o','j'三种字符),判断他是否能AC.是 ...
- 九度oj 1437 To Fill or Not to Fill 2012年浙江大学计算机及软件工程研究生机试真题
题目1437:To Fill or Not to Fill 时间限制:1 秒 内存限制:128 兆 特殊判题:否 提交:1488 解决:345 题目描述: With highways availabl ...
随机推荐
- Android-bindService远程服务启动其他应用的Activity
Service2应用,在AndroidManifest.xml文件中对外暴露MyService2服务: <!-- 代表在应用程序里,当需要该service时,会自动创建新的进程. android ...
- [WIN7]Win7建立AccessPoint(SoftAP)
要构建可以访问互联网的无线接入点,必须有台带无线网卡(正常安装完驱动)的并且能访问Internet的计算机. 1.检查环境 [网络共享中心] - > [网络适配器] 检查有线无线网络适配器是否都 ...
- PMBOK项目管理思维导图梳理
采用思维导图的形式来展示项目管理的五大过程组.九大知识领域,能更好的展示框架结构,便于理解.分析. 下图为思维导图化制的项目管理要素:灰色为启动过程组.白色为规划过程组.紫色为执行过程组.蓝色为监控过 ...
- 在ie6下将png24图片透明
没想到IETester中IE6和IE6真实版本不一样...之前一直没有实现png图片的透明度,现在发现原来是版本不一样惹的祸.总之,我将解决方法以demo的方式显示出来,以供再次利用. <!DO ...
- robot中使用evaluate转化数据格式
如果你使用robot却没有用过evaluate,那你将永远禁锢在框架中. json对象格式入参可以使用字典格式直接传入,但最近有一个接口测试的入参是一个json数组,在传参时总是提示请求参数不合法, ...
- SQL存储过程编写,包含临时表
create proc R_ProductUse_M(@id1 int,@id2 int,@id3 int) as begin ---临时表1 select a.id1,b.id2,c.id3 int ...
- 数独高阶技巧入门之六——ALS
在这个系列的第一篇(链及其简单应用)以及第四篇(简单异数链)中已经简单介绍过ALS结构的定义,即n格中存在n+1个不同的候选数 (双值格可视为特殊的ALS结构) .根据数独规则,在组成ALS的候选数 ...
- Excel转Json工具
应用程序在本地的数据配置的格式一般有JSON.XML.YAML.INI等格式,但是如果直接编写JSON数据往往不是特别方便, 今天给大家分享的是如何在EXCEL配置好数据,然后一键转换成JSON和C# ...
- Redis 工具类
项目里的Redis 工具类,写下来以备后用 public class RedisConnector { public class RedisParseResult<T> { public ...
- micropython esp8266 烧录
MicroPython 介绍 MicroPython 是一个 Python 3 语言的精简.高效实现,其包括 Python 标准库的一小部分,并经过优化,可以运行在微控制器和受限环境中运行. Micr ...