40 lines
614 B
C++
40 lines
614 B
C++
#include <bits/stdc++.h>
|
|
#define endl '\n'
|
|
using namespace std;
|
|
|
|
int n, m;
|
|
int cnt = 0;
|
|
int a[110][110];
|
|
int b[110][110];
|
|
|
|
int main(){
|
|
cin >> n >> m;
|
|
// 第一幅画读入
|
|
for(int i = 1; i <= n; i++){
|
|
for(int j = 1; j <= m; j++){
|
|
cin >> a[i][j];
|
|
}
|
|
}
|
|
// 第二幅图
|
|
for(int i = 1; i <= n; i++){
|
|
for(int j = 1; j <= m; j++){
|
|
cin >> b[i][j];
|
|
}
|
|
}
|
|
|
|
// 对比两幅图的相同位置进行比较
|
|
for(int i = 1; i <= n; i++){
|
|
for(int j = 1; j <= m; j++){
|
|
if(a[i][j] == b[i][j]){
|
|
cnt++;
|
|
}
|
|
}
|
|
}
|
|
|
|
// 相同点数 除 n * m
|
|
cout << fixed << setprecision(2);
|
|
cout << 100.0 * cnt / (n * m);
|
|
return 0;
|
|
}
|
|
|