일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- CSS
- algotythm
- HTML
- 트리
- nav-tab
- 라즈베리파이3
- ubuntu
- 16.04
- Crawling
- 2909
- 크롤링
- raspberrypi
- baekjun
- 알고리즘
- NAV
- springboot3.x
- node.js
- 백준
- 라즈베리파이3b+
- Python
- 13237
- 라즈베리파이
- Algorythm
- MongoDB
- dp
- bootstrap
- 2579
- 파이썬
- dynaminprogramming
- 라즈비안
Archives
- Today
- Total
노트
[백준] 13237번 Binary tree python 본문
n = int(input())
parent = [int(input()) for _ in range(n)]
high = [0 for i in range(n)]
for i in range(n):
if parent[i]==-1:
continue
high[i]=high[parent[i]-1]+1
for i in range(n):
print(high[i])
'알고리즘' 카테고리의 다른 글
[백준] 1240번 노드사이의 거리 python (0) | 2024.03.17 |
---|---|
[백준] 23028번 5학년은 다니기 싫어요 python (0) | 2024.03.10 |
[백준] 14501번 퇴사 python (0) | 2024.03.01 |
[백준] 1389번 케빈 베이컨의 6단계 법칙 python (0) | 2024.02.19 |
[백준] 1010번 다리 놓기 python (1) | 2024.02.12 |