Advertisement
GeorgiLukanov87

joseph

May 26th, 2022
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. soldiers = list(map(int, input().split()))
  2. k = int(input())
  3.  
  4. executed = []
  5. position = k - 1
  6. index = 0
  7. len_list = (len(soldiers))
  8.  
  9. while len_list > 0:
  10.     index = (position + index) % len_list
  11.     current_killed = (soldiers.pop(index))
  12.     len_list -= 1
  13.     executed.append(current_killed)
  14.  
  15. print(str(executed).replace(" ", ""))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement