We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 099026d commit 7218b85Copy full SHA for 7218b85
1 file changed
live11/test120/문제1/박희경.py
@@ -0,0 +1,31 @@
1
+import sys
2
+
3
+input = sys.stdin.readline
4
5
+n, m, k = map(int, input().split())
6
+board = []
7
+for _ in range(n):
8
+ board.append(list(map(str, input().rstrip())))
9
10
+cnt = []
11
+for a in range(n - k + 1):
12
+ for b in range(m - k + 1):
13
+ white = 0
14
+ black = 0
15
+ for i in range(a, a + k):
16
+ for j in range(b, b + k):
17
+ # 처음 색과 같아야 하는 부분
18
+ if (i + j) % 2 == 0:
19
+ if board[i][j] != 'W':
20
+ white += 1
21
+ else:
22
+ black += 1
23
+ # 처음 색과 달라야 하는 부분
24
25
26
27
28
29
+ cnt.append(white)
30
+ cnt.append(black)
31
+print(min(cnt))
0 commit comments