Skip to content

Commit

Permalink
Merge pull request #161 from AlgoLeadMe/5-H0ngJu
Browse files Browse the repository at this point in the history
5-H0ngJu
  • Loading branch information
H0ngJu authored Mar 25, 2024
2 parents bc817de + f24a636 commit 4b04141
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions H0ngJu/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
| 2์ฐจ์‹œ | 2024.03.07 | ํ | [๋‹ค๋ฆฌ๋ฅผ ์ง€๋‚˜๋Š” ํŠธ๋Ÿญ](https://school.programmers.co.kr/learn/courses/30/lessons/42583) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/153 |
| 3์ฐจ์‹œ | 2024.03.10 | ํž™ | [N๋ฒˆ์งธ ํฐ ์ˆ˜](https://www.acmicpc.net/problem/2075) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/156 |
| 4์ฐจ์‹œ | 2024.03.13 | ํž™ | [๋ฌธ์ œ์ง‘](https://www.acmicpc.net/problem/1766) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/158 |
| 5์ฐจ์‹œ | 2024.03.16 | ๊ตฌํ˜„ | [์š”์„ธํ‘ธ์Šค ๋ฌธ์ œ](https://www.acmicpc.net/problem/1158) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/161 |

---
27 changes: 27 additions & 0 deletions H0ngJu/๊ตฌํ˜„/์š”์„ธํ‘ธ์Šค.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import sys

def input():
return sys.stdin.readline().rstrip()

def solution(k):
location = 0
cnt = 0

while table:
if cnt == k - 1:
answer.append(table.pop(location))
location -= 1 # ์‚ญ์ œํ•œ ๊ฒฝ์šฐ์—๋Š” ์œ„์น˜๋ฅผ ์•ž์œผ๋กœ ์ด๋™
cnt = 0
else:
cnt += 1
if len(table) != 0:
location = (location + 1) % len(table)

return answer

n, k = map(int, input().split())
table = [i + 1 for i in range(n)]
answer = []

solution(k)
print("<" + ", ".join(map(str, answer)) + ">")

0 comments on commit 4b04141

Please sign in to comment.