Files

34 lines
553 B
C++

#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int n, m, num, cnt = 0;
int arr[110][110];
int main(){
cin >> n >> m;
// 第一幅图
for(int i = 1; i <= n; i++){
for(int j = 1; j <= m; j++){
cin >> arr[i][j];
}
}
// 第二幅图
for(int i = 1; i <= n; i++){
for(int j = 1; j <= m; j++){
// arr[i][j]
cin >> num;
if(num == arr[i][j]){
cnt++;
}
}
}
// 相同的像素块有cnt个 总数 n * m 相同的像素块 / 总数
// int z = n * m;
cout << fixed << setprecision(2) << 100.0 * cnt / (n * m);
return 0;
}