题解 | #图像相似度#
图像相似度
http://www.nowcoder.com/practice/f2952ee3bb5c48a9be6c261e29dd1092
while True:
try:
num=input().split(" ")
m,n=map(int,num)
pixel_lista=[]
pixel_listb=[]
same_count=0
for i in range(m):
pixel=input().split(" ")
pixel_lista.append(list(map(int,pixel)))
for i in range(m):
pixel=input().split(" ")
pixel_listb.append(list(map(int,pixel)))
for i in range(m):
for j in range(n):
if pixel_lista[i][j]==pixel_listb[i][j]:
same_count+=1
print("{:.2f}".format(same_count*100/(m*n)))
except:
break