complete 1158.py 11025.py 11866.py

This commit is contained in:
2021-03-17 23:39:29 +09:00
parent b9d5260b97
commit 497ca03cdc
3 changed files with 55 additions and 0 deletions

23
zeta_python/11866.py Normal file
View File

@@ -0,0 +1,23 @@
from collections import deque
def solve(N, K):
q = deque(range(1, N + 1))
tq = deque()
cnt = 0
ret = []
while q:
while q:
cnt += 1
cnt %= K
if cnt % K == 0:
ret.append(q.popleft())
else:
tq.append(q.popleft())
q = tq
tq = deque()
return "<" + ", ".join(map(str, ret)) + ">"
if __name__ == "__main__":
print(solve(*map(int, input().split())))