Advertisement
Bad_Programist

Untitled

Nov 28th, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.24 KB | None | 0 0
  1. a = input()
  2. b = a.split(' ')
  3. N = int(b[0])
  4. K = int(b[1])
  5. c = 0
  6. Players = [i + 1 for i in range(N)]
  7. while len(Players) != 1:
  8.     for i in range(K):
  9.         c = c % N + 1
  10.     Players.pop(c - 1)
  11.     N -= 1
  12.     c -= 1
  13. print(Players[0])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement