728x90
반응형
기본적인 이분 탐색 문제이다.
while 1:
n = int(input())
if n == 0:
break
s, e = 1, 50
while s <= e:
m = (s+e)//2
print(m, end=' ')
if m == n:
break
elif m < n:
s = m+1
else:
e = m-1
print()
728x90
반응형
'Agorithm > 백준 알고리즘' 카테고리의 다른 글
| 백준 알고리즘 13301번 타일 장식물(python) (0) | 2021.03.19 |
|---|---|
| 백준 알고리즘 9625번 BABBA(python) (0) | 2021.03.19 |
| 백준 알고리즘 11448번 Ga(python) (0) | 2021.03.18 |
| 백준 알고리즘 6798번 Knight Hop(python) (0) | 2021.03.18 |
| 백준 알고리즘 6229번 Bronze Lilypad Pond(python) (0) | 2021.03.18 |