题解 | #矩阵相等判定#
矩阵相等判定
http://www.nowcoder.com/practice/2f058b1e89ae43f7ab650c0fd0b71fa8
int main() {
int n, m;
scanf("%d %d", &n, &m);
int val[2][n][m], count = 0;
for (int i = 0; i < 2; i++) {
for (int j = 0; j < n; j++) {
for (int k = 0; k < m; k++) {
scanf("%d ", &val[i][j][k]);
}
}
if (i == 1) { //判断是否输入完第二个矩阵
for (int x = 0; x < n; x++) {
for (int y = 0; y < m; y++) {
//判断第二个矩阵内的值是否与第一个矩阵的值相等
if (val[0][x][y] == val[1][x][y]) count++;
}
}
if (count == n * m) printf("Yes");
else printf("No");
count = 0;
}
}
return 0;
}