Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 30 | 31 |
Tags
- spring cloud
- Kotlin
- java 기술면접
- 백준
- MySQL
- spring oauth
- 백준 16235
- 백준 15685
- Coroutine
- java
- sql 기술면접
- 백준 19238
- Spring Boot
- MSA
- Spring
- with recursive
- 백준 16236
- 웹어플리케이션 서버
- 백준 17626
- 백준 17779
- 프로래머스
- 백준 파이썬
- JPA
- re.split
- spring security
- 백준 16719
- 파이썬
- JVM
- 프로그래머스
- springboot
Archives
- Today
- Total
시작이 반
[백준] 1992번 (python 파이썬) 본문
SMALL
백준 2630문제와 같은 문제이다.
[백준] 2630번 (python 파이썬)
Divide and Conquer에 대한 문제이다. 1. 해당 종이가 일괄된 색이 아니면 4등분을 한다. 2. 4등분된 종이를 다시 검사한다. 1, 2를 일괄된 색일때까지 반복한다. 처음 푼방법 종이를 모든 수에 대해 검사
tmdrl5779.tistory.com
출력부분만 고려하면 된다.
n = int(input())
graph = [list(map(int, input())) for _ in range(n)]
def dnc(x, y, n):
check = graph[x][y]
for i in range(x, x + n):
for j in range(y, y + n):
if check != graph[i][j]:
check = -1
break
if check == -1:
print("(", end='')
n = n // 2
dnc(x, y, n) # 오른쪽 위
dnc(x, y + n, n) # 왼쪽 위
dnc(x + n, y, n) # 오른쪽 아래
dnc(x + n, y + n, n) # 왼쪽 아래
print(")", end='')
elif check == 1:
print(1, end='')
else:
print(0, end='')
dnc(0, 0, n)
LIST
'알고리즘 > 백준' 카테고리의 다른 글
[백준] 20003번 (python 파이썬) (0) | 2021.03.14 |
---|---|
[백준] 1780번 (python 파이썬) (2) | 2021.03.08 |
[백준] 2630번 (python 파이썬) (0) | 2021.03.06 |
[백준] 1021번 (python 파이썬) (0) | 2021.03.04 |
[백준] 1874번 (python 파이썬) (0) | 2021.03.04 |