백준 - (# 1158)

https://www.acmicpc.net/problem/1158


Code

N, K = map(int,input().split())
circlist = list(range(1,N+1))
result = []

i = K - 1
while True:
    result.append(circlist.pop(i))
    if len(circlist) == 0:
        break
    i = (i+K-1)%len(circlist)

print('<'+', '.join(map(str, result))+'>')

좋은 웹페이지 즐겨찾기