✔ 풀이를 위한 아이디어
✔ 코드
import sys
N, K = map(int, sys.stdin.readline().split())
counter = [0]*N
current = K - 1
answer = []
while True:
counter[current] = 1
answer.append(current + 1)
if len(answer) == N:
break
for _ in range(K):
while True:
current += 1
if current >= N:
current = current % N
if counter[current] == 0:
break
print("<{}".format(answer[0]), end="")
for i in range(1, N):
print(", {}".format(answer[i]), end="")
print(">")
✔ 관련 개념