Advertisement
Nenogzar

Untitled

Jan 29th, 2024
623
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. people_in_the_circle = list(map(int, input().split()))
  2. number_k = int(input())
  3.  
  4. people_in_the_suicided = []
  5. suicided_list = []
  6.  
  7. count = 1
  8. index = 0
  9.  
  10. while len(people_in_the_circle) > 0:
  11.     index = (index + number_k - 1) % len(people_in_the_circle)
  12.     suicided_person = people_in_the_circle.pop(index)
  13.     suicided_list.append(str(suicided_person))
  14.  
  15. print('[' + ','.join(suicided_list) + ']')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement