Skip to content

Commit 8eb483d

Browse files
authored
Create [08]_5.cpp
1 parent 0f98c54 commit 8eb483d

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

Solutions/[08]_5.cpp

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#include <bits/stdc++.h>
2+
3+
using namespace std;
4+
5+
int n, m;
6+
char data[50][50];
7+
int row[50], column[50];
8+
9+
int main() {
10+
cin >> n >> m;
11+
for (int i = 0; i < n; i++) {
12+
for (int j = 0; j < m; j++) {
13+
cin >> data[i][j];
14+
if (data[i][j] == 'X') {
15+
row[i] = 1;
16+
column[j] = 1;
17+
}
18+
}
19+
}
20+
21+
int row_count = 0;
22+
for (int i = 0; i < n; i++) {
23+
if (row[i] == 0) row_count++;
24+
}
25+
26+
int column_count = 0;
27+
for (int j = 0; j < m; j++) {
28+
if (column[j] == 0) column_count++;
29+
}
30+
31+
cout << max(row_count, column_count);
32+
}

0 commit comments

Comments
 (0)