(Python/Lv2) 쿼드 압축 후 갯수 세기
문제 출처:https://school.programmers.co.kr/learn/courses/30/lessons/68936 풀이: def check(x, y, n, arr): # 탈출 조건 if n == 1: if arr[x][y] == 1: return [0, 1] # 1 카운트 증가 else: return[1, 0] # 0카운트 증가 left_up = check(x, y, n//2, arr) # 2사분면 체크 right_up = check(x, y+n//2, n//2, arr) # 1사분면 체크 left_down = check(x+n//2, y, n//2, arr) # 3사분면 체크 right_down = check(x+n//2, y+n//2, n//2, arr) #4사분면 체크 # 각 축소 후 압..
2023. 5. 6.