https://www.acmicpc.net/problem/1158
from collections import deque
n, k = map(int, input().split())
arr = [i for i in range(1, n + 1)]
dq = deque(arr)
print("<", end="")
while len(dq) != 1:
for i in range(k - 1):
dq.append(dq.popleft())
print(dq.popleft(), end=", ")
print(f"{dq.pop()}>")
큐를 이용하면 쉽게 풀 수 있다.
k번째 번호가 빠지는 것이니까 처음 부터 카운트해주면 k - 1번째 번호가 빠진다.
출력을 위해서 dq의 길이가 1이 남을 때까지 반복문을 통해서 번호를 빼고 출력한다