题解 | #序列重组矩阵#
矩阵相等判定
http://www.nowcoder.com/practice/2f058b1e89ae43f7ab650c0fd0b71fa8
#include<stdio.h>
int main()
{
int l = 0;
int arr[40][40] = { 0 };
int n, m;
scanf("%d%d", &n, &m);
for (int i = 0; i < 2*n; i++)
{
for (int p = 0; p < m; p++)
{
scanf("%d",&arr[i][p]);
}
}
for (int a = 0; a < n; a++)
{
for (int b = 0; b < m; b++)
{
if (arr[a][b] == arr[a + n][b])
l++;
//else
// break;
}
}
if (l == n * m)
printf("Yes\n");
else
printf("No\n");
return 0;
}
int main()
{
int l = 0;
int arr[40][40] = { 0 };
int n, m;
scanf("%d%d", &n, &m);
for (int i = 0; i < 2*n; i++)
{
for (int p = 0; p < m; p++)
{
scanf("%d",&arr[i][p]);
}
}
for (int a = 0; a < n; a++)
{
for (int b = 0; b < m; b++)
{
if (arr[a][b] == arr[a + n][b])
l++;
//else
// break;
}
}
if (l == n * m)
printf("Yes\n");
else
printf("No\n");
return 0;
}