백준 1780 - 종이의 개수 (파이썬)
Updated:
Answer
N = int(input())
g = [list(map(int, input().split())) for _ in range(N)]
answer = []
def solution(x, y, N):
check = g[x][y]
for i in range(x, x + N):
for j in range(y, y + N):
if check != g[i][j]:
N = N // 3
solution(x, y, N)
solution(x, y + N, N)
solution(x + N, y, N)
solution(x + N, y + N, N)
solution(x + (N * 2), y, N)
solution(x, y + (N * 2), N)
solution(x + (N * 2), y + N, N)
solution(x + N, y + (N * 2), N)
solution(x + (N * 2), y + (N * 2), N)
return
if check == 0:
answer.append(0)
elif check == 1:
answer.append(1)
else:
answer.append(-1)
solution(0, 0, N)
print(answer.count(-1))
print(answer.count(0))
print(answer.count(1))