ํฐ์คํ ๋ฆฌ ๋ทฐ
728x90
๐ฉ ํธ๋ฆฌ(tree)
์ฝ๋
T = int(input())
def in_order(i):
global cnt
if i <= N:
in_order(2*i)
tree[i] = cnt
cnt += 1
in_order(2*i+1)
for tc in range(1, T+1):
N = int(input())
tree = [0 for _ in range(N+1)]
cnt = 1
in_order(1)
print("#{} {} {}".format(tc, tree[1], tree[N//2]))
'algorithm > swea' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[swea] 5178. ๋ ธ๋์ ํฉ / python ํ์ด์ฌ (0) | 2021.04.09 |
---|---|
[swea] 5177. ์ด์งํ / python ํ์ด์ฌ (0) | 2021.04.09 |
[swea] 5174. subtree / python ํ์ด์ฌ (0) | 2021.04.09 |
[swea] 1859. ๋ฐฑ๋ง ์ฅ์ ํ๋ก์ ํธ / python ํ์ด์ฌ (0) | 2021.04.09 |
[swea] 1961. ์ซ์ ๋ฐฐ์ด ํ์ / python ํ์ด์ฌ (0) | 2021.04.09 |
๋๊ธ
๊ธ ๋ณด๊ดํจ
TAG
- 17406 ๋ฐฐ์ด๋๋ฆฌ๊ธฐ4
- merge ์๋ฌ
- ์๊ณ ๋ฆฌ์ฆ
- 20056 ๋ง๋ฒ์ฌ ์์ด์ ํ์ด์ด๋ณผ
- ํ์ด์ฌ
- ์์ด๋๋ง์๊ธฐ
- 21609 ์์ด ์คํ๊ต
- 20057 ๋ง๋ฒ์ฌ ์์ด์ ํ ๋ค์ด๋
- 2579 ๊ณ๋จ์ค๋ฅด๊ธฐ
- dp
- ๋ฐฑ์ค
- ์ผ์ฑ๊ธฐ์ถ
- ํ๋ก๊ทธ๋๋จธ์ค
- ๋ธ๋ฃจํธํฌ์ค
- BFS
- swea
- Python
- ๊ธฐ์ง๊ตญ์ค์น
- merge์๋ฌ
- dfs
- ๋ณด์์ผํ
- ์ผ์ฑ์ฝํ
- react
- 2018 ์นด์นด์ค ๊ณต์ฑ
- git ๋ฏธ๋ฌ๋ง
์ต๊ทผ์ ์ฌ๋ผ์จ ๊ธ
- Total
- Today
- Yesterday
์ต๊ทผ์ ๋ฌ๋ฆฐ ๋๊ธ