Advertisement
Spocoman

04. Josephus Permutation

Jan 24th, 2022
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.26 KB | None | 0 0
  1. lst = input().split(' ')
  2. number = int(input())
  3. output = []
  4.  
  5. while len(lst) != 0:
  6.     for i in range(number - 1):
  7.         lst.append(lst[0])
  8.         del lst[0]
  9.     output.append(int(lst[0]))
  10.     del lst[0]
  11.  
  12. print(str(output).strip().replace(' ', ''))
  13.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement