题解 | #矩阵相等判定#
矩阵相等判定
https://www.nowcoder.com/practice/2f058b1e89ae43f7ab650c0fd0b71fa8
#include <stdio.h> int main() { int n, m = 0; scanf("%d %d", &n, &m); int arr1[10][10] = {0}; int arr2[10][10] = {0}; int i, j = 0; for ( i = 0; i < n; i++) { for (j = 0; j < m; j++) { scanf("%d", &arr1[i][j]); } } for ( i = 0; i < n; i++) { for ( j = 0; j < m; j++) { scanf("%d", &arr2[i][j]); } } //判断两个矩阵是否相等 for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { if (arr1[i][j] != arr2[i][j]) { printf("No\n"); return 0; } } } printf("Yes\n"); return 0; }
c语言刷题 文章被收录于专栏
c语言刷题题目