You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
691 B
30 lines
691 B
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
|
|
int main() {
|
|
int a[100][100] = {0}, b[100][100] = {0};
|
|
int m, n;
|
|
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];
|
|
}
|
|
}
|
|
|
|
int samecount = 0;
|
|
for (int i = 0; i < m; ++i) {
|
|
for (int j = 0; j < n; ++j) {
|
|
if (a[i][j] == b[i][j])samecount++;
|
|
}
|
|
}
|
|
//保留两位小数输出
|
|
cout << fixed << setprecision(2) << 100 * (samecount * 1.0) / (m * n) << endl;
|
|
return 0;
|
|
}
|