Skip to content

Commit 65b9498

Browse files
authored
[BOJ] 1158 요세푸스 문제 (S4)
1 parent b519e50 commit 65b9498

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

김지호/7주차/260212.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
n, k = map(int, input().split())
2+
people = list(range(1, n + 1)) #둥글게 모여앉은 사람들
3+
k_index = 0
4+
result = []
5+
6+
for i in range(n): #n번만 반복하면 되니까
7+
k_index = (k_index + k - 1) % len(people)
8+
result.append(people.pop(k_index))
9+
10+
print('<' + str(result)[1:-1] + '>')

0 commit comments

Comments
 (0)