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
- GroupBy
- 백준
- 전처리
- geopy
- 그래프이론
- Geocoding
- 건축물대장정보
- NLP
- 그래프탐색
- 유클리드
- 코사인유사도
- 공공데이터
- pandas
- 깊이우선탐색
- 비트마스킹
- 누적합
- TF-IDF
- cosine
- 분할정복
- 유사도
- 자연어처리
- 구현
- 너비우선탐색
- 우선순위큐
- 그리디
- xmltodict
- 수학
- 지진대피소
- dp
- 재귀
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