题解 | #矩阵相等判定#
矩阵相等判定
https://www.nowcoder.com/practice/2f058b1e89ae43f7ab650c0fd0b71fa8
#include <stdio.h> #define N 10 int main() { int n = 0; int m = 0; while (2 == scanf("%d %d", &n, &m)) { int i = 0; int flag = 0; int arr[N] = {0}; for (i = 0; i < 2 * (n * m); i++) { if (i < (n * m)) { scanf("%d", &arr[i]); } else { scanf("%d", &arr[i]); if (arr[i - (n * m)] == arr[i]) { flag = 1; } else { printf("No\n"); break; } } } if (1 == flag && i == 2 * (n * m)) { printf("Yes\n"); } } return 0; }