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 | 
													Tags
													
											
												
												- 누적합
- 유사도
- cosine
- 코사인유사도
- 그리디
- 자연어처리
- 그래프탐색
- NLP
- 전처리
- 수학
- 우선순위큐
- 깊이우선탐색
- 백준
- Geocoding
- 구현
- xmltodict
- 재귀
- TF-IDF
- GroupBy
- 건축물대장정보
- 비트마스킹
- 너비우선탐색
- 유클리드
- 공공데이터
- pandas
- dp
- 분할정복
- 지진대피소
- 그래프이론
- geopy
													Archives
													
											
												
												- Today
- Total
정리용
[백준 1780] 파이썬 - 종이의 개수 본문
1. 코드 설명
n = int(input())
arr = [list(map(int, input().split())) for _ in range(n)]
minus = 0
plus = 0
zero = 0
def cut (x, y, n) :
  global minus, plus, zero
  for i in range(x, x+n):
    for j in range( y, y+n):
      if arr[x][y] != arr[i][j]:
        # 9 등분으로 나누고 시작점마다 함수 실행
        for w in range (3) :
          for e in range (3) :
            cut(x + n // 3 * w,   y+  n // 3 * e,    n // 3)
        return
  if arr[x][y] == 1 :
    plus += 1
  elif arr[x][y] == -1 :
    minus += 1
  else :
    zero += 1
cut(0,0,n)
print(minus)
print(zero)
print(plus)
2. 주의사항
'알고리즘 > 백준' 카테고리의 다른 글
| [백준 5525] 파이썬 - ioioi (0) | 2021.12.30 | 
|---|---|
| [백준 1992] 파이썬 - 쿼드트리 (0) | 2021.12.27 | 
| [백준] (0) | 2021.12.20 | 
| [백준 1904] 파이썬 - (0) | 2021.12.19 | 
| [백준 1010] (0) | 2021.12.18 | 
			  Comments
			
		
	
               
           
					
					
					
					
					
					
				