题解 | #图像相似度#
图像相似度
https://www.nowcoder.com/practice/f2952ee3bb5c48a9be6c261e29dd1092
#include <stdio.h> int main() { int m = 0, n = 0;//行和列 int number = 0; int A = 0; scanf("%d %d", &m, &n); int arr_1[100 * 100] = { 0 }; int i = 0; for (i = 0; i < m * n; i++) { scanf("%d", &arr_1[i]); } for (i = 0; i < m * n; i++) { A = arr_1[i]; scanf("%d", &arr_1[i]); if (arr_1[i] == A) { number++; } } float result = (float)number / (float)(m * n); printf("%.2f", result * 100); return 0; }