提交时间:2024-12-04 16:45:56

运行 ID: 58097

#include<iostream> #include<iomanip> using namespace std; int main() { int m, n; int image1[100][100]; int image2[100][100]; float diff = 0; cin >> m >> n; //赋值 for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { cin >> image1[i][j]; } } for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { cin >> image2[i][j]; } } for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { if (image1[i][j] == image2[i][j]) diff++; } } cout << fixed << setprecision(2) << diff / (m * n) * 100 << endl; return 0; }