카드2
내 코드
from sys import stdin
from collections import deque
N = int(stdin.readline())
if N == 1:
print(1)
else:
deq = deque([i for i in range(1, N+1)])
while True:
deq.popleft()
if len(deq) == 1:
break
deq.append(deq.popleft())
print(deq.pop())
728x90
'Algorithm\CodingTest > Baekjoon' 카테고리의 다른 글
[Baekjoon] [20920] 실버3 영단어 암기는 괴로워 Python (0) | 2024.01.29 |
---|---|
[Baekjoon] [13305] 실버3 - 주유소 Python (1) | 2024.01.29 |
[Baekjoon] [17266] 실버4 - 어두운 굴다리 Python (1) | 2024.01.29 |
[Baekjoon] [9017] 실버3 - 크로스 컨트리 Python (0) | 2024.01.24 |
[Baekjoon] [1244] 실버4 - 스위치 켜고 끄기 Python (1) | 2024.01.24 |