Skip to content

Baekjoon 1158

1. Problem

문제 확인하기

2. Solution

from collections import deque

N, K = map(int, input().split())
queue = deque([i for i in range(1, N+1)])
res = []
for _ in range(N):
    for i in range(K-1):
        queue.append(queue.popleft())
    res.append(queue.popleft())
print('<', end='')
print(*res, sep=', ', end='')
print('>')