Written by
최태열
on
on
[Python][정올][Intermediate_Coder] 1335 : 색종이 만들기
[Python][정올][Intermediate_Coder] 1335 : 색종이 만들기
코드
blue = 0
white = 0
def divde(N, board):
global blue, white
check = sum([sum(i) for i in board])
if check == N**2:
blue+=1
return
elif check == 0:
white+=1
return
d = [[],[],[],[]]
for x in range(N//2):
d[0].append(board[x][:N//2])
d[1].append(board[x][N//2:])
for x in range(N//2,N):
d[2].append(board[x][:N//2])
d[3].append(board[x][N//2:])
for i in d:
divde(N//2,i)
N = int(input())
board = [list(map(int,input().split())) for _ in range(N)]
divde(N,board)
print(white)
print(blue)
Discussion and feedback