[백준] - 2164 카드2 (Python)

밀루·2023년 8월 19일
0

BOJ

목록 보기
22/43

문제 링크

코드

import sys
from collections import deque
n=int(sys.stdin.readline().strip())
d1=deque(list(i for i in range(1, n+1)))

while len(d1)>1:
    d1.popleft()
    d1.append(d1.popleft())

print(d1[0])

python의 덱을 사용해 풀었다.

profile
이밀루의 도전

0개의 댓글