'commit'
This commit is contained in:
29
TangDou/XiTi/1081.cpp
Normal file
29
TangDou/XiTi/1081.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
int a[100][100] = {0}, b[100][100] = {0};
|
||||
int m, n;
|
||||
cin >> m >> n;
|
||||
for (int i = 0; i < m; ++i) {
|
||||
for (int j = 0; j < n; ++j) {
|
||||
cin >> a[i][j];
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < m; ++i) {
|
||||
for (int j = 0; j < n; ++j) {
|
||||
cin >> b[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
int samecount = 0;
|
||||
for (int i = 0; i < m; ++i) {
|
||||
for (int j = 0; j < n; ++j) {
|
||||
if (a[i][j] == b[i][j])samecount++;
|
||||
}
|
||||
}
|
||||
//保留两位小数输出
|
||||
cout << fixed << setprecision(2) << 100 * (samecount * 1.0) / (m * n) << endl;
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user