//刚开始半天没看懂题目,其实就是输入两个m×n的矩阵,矩阵的每个元素都是由0和1组成,寻找两个矩阵相同位置对应的数字是否相同,将相同的数字总数除以m×n再乘以100就是所对应的对比度
#include <stdio.h>
int main() {
    int a = 0, b = 0, mid = 0;
    float sum = 0;
    int same = 0;
    int i = 0, j = 0;
    int arr1[10][10] = { 0 };
    int arr2[10][10] = { 0 };
    scanf("%d %d", &a, &b);
    for (i = 0; i < a; i++) {
        for (j = 0; j < b; j++) {
            scanf("%d", &mid);
            arr1[i][j] = arr1[i][j] + mid;
        }
    }
    for (i = 0; i < a; i++) {
        for (j = 0; j < b; j++) {
            scanf("%d", &mid);
            arr2[i][j] = arr2[i][j] + mid;
        }
    }
    for (i = 0; i < a; i++) {
        for (j = 0; j < b; j++) {
            if (arr1[i][j] == arr2[i][j]) {
                same++;
            }
        }
    }
    printf("%.2f\n", (float)(same * 100) / (a * b));
    return 0;
}