[알고리즘/백준] 2164번 : 카드2(python)

유현민·2022년 6월 19일
0

알고리즘

목록 보기
214/253

큐를 이용하여 문제를 풀었다.

from collections import deque


N = int(input())
q = deque()

for i in range(1, N + 1):
    q.append(i)
l = N
while l > 1:
    q.popleft()
    l -= 1
    q.append(q.popleft())
print(*q)
profile
smilegate megaport infra

0개의 댓글