-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1018.py
More file actions
29 lines (25 loc) · 881 Bytes
/
1018.py
File metadata and controls
29 lines (25 loc) · 881 Bytes
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
A = ["WBWBWBWB", "BWBWBWBW", "WBWBWBWB", "BWBWBWBW",
"WBWBWBWB", "BWBWBWBW", "WBWBWBWB", "BWBWBWBW"]
B = ["BWBWBWBW", "WBWBWBWB", "BWBWBWBW", "WBWBWBWB",
"BWBWBWBW", "WBWBWBWB", "BWBWBWBW", "WBWBWBWB"]
column, row = map(int, input().split())
chess = []
for i in range(column): # 입력 받기
chess.append(input())
cnt = []
for idxc in range(0, row-8+1):
for idxr in range(0, column-8+1):
temp_cntA = 0
temp_cntB = 0
for i in range(0, 8):
for j in range(0, 8):
if chess[i+idxr][j+idxc] != A[i][j]:
temp_cntA += 1
else:
pass
if chess[i+idxr][j+idxc] != B[i][j]:
temp_cntB += 1
else:
pass
cnt.append(min(temp_cntA, temp_cntB))
print(min(cnt))