from collections import deque
n,k = map(int,input().split())
queue = []
for i in range(n):
queue.append(i+1)
print("<" ,end="")
i = 0
while len(queue) > 1:
i = i+k
if i > len(queue):
i = i %len(queue)
if i == 0:
i = i+ len(queue)
i = i-1
print(str(queue.pop(i)),end=", ")
print(f"{str(queue.pop())}>")
'문제풀이 > 백준(Boj) 문제풀이' 카테고리의 다른 글
[백준][DFS] 1012. 유기농 배추 (파이썬/Python) (0) | 2021.12.02 |
---|---|
[백준][DFS] 2667. 단지번호붙이기 (파이썬/Python) (0) | 2021.12.02 |
[백준][큐 & 덱] 18258. 큐 2 (파이썬/Python) (0) | 2021.11.17 |
[백준][스택] 17298. 오큰수 (파이썬/Python) (0) | 2021.11.16 |
[백준][스택] 1873. 스택 수열 (파이썬/Python) (0) | 2021.11.15 |