求解

fgjpokyug  •  3个月前


include <bits/stdc++.h>

using namespace std;

int main() {

int a[50][50], b[50][50], m, n, sum = 0;
cin >> m >> n;
for (int i = 0; i < m; i++) {
	for (int j = 0; j < n; j++) {
		cin >> a[i][j];
	}
}
for (int i = 0; i < m; i++) {
	for (int j = 0; j < n; j++) {
		cin >> b[i][j];
	}
}
for (int i = 0; i < m; i++) {
	for (int j = 0; j < n; j++) {
		if (a[i][j] == b[i][j]) {
			sum++;
		}
	}
}
cout << sum;
return 0;

}


评论:

请先登录,才能进行评论