mirror of
https://github.com/iritmaximus/tira.git
synced 2026-10-12 19:13:47 +03:00
29 lines
493 B
Python
29 lines
493 B
Python
from collections import deque
|
|
|
|
|
|
def solve(n, k):
|
|
|
|
list = deque()
|
|
|
|
for x in range(1, n + 1):
|
|
list.append(x)
|
|
|
|
for x in range(k):
|
|
first_val = list[0]
|
|
second_val = list[1]
|
|
|
|
list.append(second_val)
|
|
list.append(first_val)
|
|
|
|
list.popleft()
|
|
list.popleft()
|
|
|
|
return list[0]
|
|
|
|
|
|
if __name__ == "__main__":
|
|
print(solve(4, 3)) # 4
|
|
print(solve(12, 5)) # 11
|
|
print(solve(99, 555)) # 11
|
|
print(solve(12345, 54321)) # 9875
|