九度1001 A+B for Matrices

/*********************************
 *    日期:2012-6-23
 *    作者:SJF0115
 *    题号: 九度1001
 *    题目:A+B for Matrices
 *    结果:AC
 *    题意:
 *    总结:
**********************************/
#include<stdio.h>
int main(){
	int M,N;
	int Matrices[11][11];
	while(scanf("%d",&M),M){
		scanf("%d",&N);
		int i,j;
		for(i = 0;i<M;i++){
			for(j = 0;j<N;j++){
				scanf("%d",&Matrices[i][j]);
			}
		}
		int a;
		int count = 0;
		int CountOfZero = 0;
		for(i = 0;i<M;i++){
			for(j = 0;j<N;j++){
				scanf("%d",&a);
				Matrices[i][j] += a;
				count += Matrices[i][j];
			}
			if(count == 0){
				CountOfZero++;
			}
			count = 0;
		}
		//计算列
		count = 0;
		for(i = 0;i<N;i++){
			for(j = 0;j<M;j++){
				count += Matrices[j][i];
			}
			if(count == 0){
				CountOfZero++;
			}
			count = 0;
		}
		printf("%d\n",CountOfZero);
	}
	return 0;
}

你可能感兴趣的:(ini)