题目1001:A+B for Matrices
来源:互联网 发布:此谓知本 此谓知之至也 编辑:程序博客网 时间:2024/04/30 06:09
#include <iostream>#include <stdio.h> int main(){ int M ,N ; while(scanf("%d %d",&M,&N) && M != 0){ int a[M][N], b[M][N],cnt=0; for(int i=0;i<M;i++) for(int j=0;j<N;j++) scanf("%d",&a[i][j]); for(int i=0;i<M;i++) for(int j=0;j<N;j++) scanf("%d",&b[i][j]); for(int i=0;i<M;i++) for(int j=0;j<N;j++) a[i][j]=a[i][j] + b[i][j]; for(int i=0;i<M;i++){ for(int j=0;j<N;j++){ if(a[i][j] != 0) break; if(j == N-1 && a[i][j]==0) cnt++; } } for(int i=0;i<N;i++){ for(int j=0;j<M;j++){ if(a[j][i] != 0) break; if(j == M-1 && a[j][i]==0) cnt++; } } printf("%d\n",cnt); } return 0;} /************************************************************** Problem: 1001 User: cust123 Language: C++ Result: Accepted Time:0 ms Memory:1520 kb****************************************************************/
0 0
- 题目1001:A+B for Matrices
- 题目1001:A+B for Matrices
- 题目1001:A+B for Matrices
- 题目1001:A+B for Matrices
- 题目1001:A+B for Matrices
- 题目1001:A+B for Matrices
- 题目1001:A+B for Matrices
- 题目1001:A+B for Matrices
- 题目1001:A+B for Matrices
- 题目1001:A+B for Matrices
- 题目1001:A+B for Matrices
- 题目1001:A+B for Matrices
- 题目1001:A+B for Matrices
- 题目1001: A+B for Matrices
- 题目1001:A+B for Matrices
- 题目1001:A+B for Matrices
- 题目1001:A+B for Matrices
- 题目1001:A+B for Matrices
- 开源 java CMS
- 题目1000:计算a+b
- 关闭SELINUX服务
- 《开发自己的搜索引擎》读书笔记——索引的建立
- spring常用注解使用解析
- 题目1001:A+B for Matrices
- SVM-libsvm 配置
- 【代码笔记】iOS-GCD用法
- glHint、gluLookAt、glOrtho、gluPerspective、glViewport
- Ubuntu 14.04安装和卸载搜狗拼音输入法
- HNOI2015开店
- 快速排序算法的思想和几种实现方式
- hdu3089(约瑟夫的优化)
- React 介绍及实践教程