#Z15205. 图像相似度
图像相似度
Description
Given two black-and-white images of the same size (represented by 0-1 matrices), calculate their similarity.
Note: If two images have the same pixel value at the same position, they are considered to have identical pixels at that location.
The similarity of the two images is defined as the percentage of identical pixels relative to the total number of pixels.
Input Format
The first line contains two integers, m and n, representing the number of rows and columns of the images, separated by a single space. (1 ≤ m ≤ 100, 1 ≤ n ≤ 100).
The following m lines each contain n integers (0 or 1), representing the pixel values of the first black-and-white image. Adjacent numbers are separated by a single space.
The subsequent m lines each contain n integers (0 or 1), representing the pixel values of the second black-and-white image. Adjacent numbers are separated by a single space.
Output Format
A real number representing the similarity (expressed as a percentage), rounded to two decimal places.
3 3
1 0 1
0 0 1
1 1 0
1 1 0
0 0 1
0 0 1
44.44