-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy patha.cpp
45 lines (43 loc) · 1021 Bytes
/
a.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <bits/stdc++.h>
using namespace std;
int main(){
string board[8];
bool done[8][8];
fill(done[0], done[7] + 8, false);
for(int i = 0; i < 8; i++){
cin >> board[i];
}
int strokes = 0;
for(int i = 0; i < 8; i++){
bool horz = true;
for(int j = 0; j < 8; j++){
if(board[i][j] != 'B'){
horz = false;
}
}
if(horz){
for(int j = 0; j < 8; j++){
done[i][j] = true;
}
}
strokes += horz;
}
for(int i = 0; i < 8; i++){
bool vert = true;
for(int j = 0; j < 8; j++){
if(board[j][i] != 'B'){
vert = false;
}
}
int multiplier = 0;
if(vert){
for(int j = 0; j < 8; j++){
if(done[j][i] == false){
multiplier = 1;
}
}
}
strokes += vert * multiplier;
}
cout << strokes << endl;
}