https://www.acmicpc.net/problem/1158
from collections import deque
n,k = map(int,input().split())
data = deque([x for x in range(1,n+1)])
answer = []
while data:
# 1. k-1만큼 왼쪽으로 회전시키기
data.rotate(-k+1)
# 2. 제거하기
answer.append(str(data[0]))
data.popleft()
print("<%s>" % (", ".join(answer)))
'알고리즘' 카테고리의 다른 글
백준16918번 : 봄버맨(Python) (0) | 2021.03.31 |
---|---|
백준20061 : 모노미노도미노2(Python) (0) | 2021.03.11 |
백준 1021번 : 회전하는 큐 (Python) (0) | 2021.02.03 |
백준 17135번 : 캐슬 디펜스 (Python) (0) | 2021.01.25 |
백준 2573번 : 빙산 (python) (0) | 2021.01.20 |