Last Sweet Seat
Prisoners sit in a circle, and sweets are handed out one by one starting from a chosen seat. The function save_the_prisoner receives the number of prisoners n, the number of sweets m, and the starting prisoner s. Determine who receives the last sweet. Return that prisoner’s seat number.
Примеры
Ввод
5, 2, 1Вывод
2Ввод
5, 2, 2Вывод
3Ввод
7, 19, 2Вывод
6Нужно реализовать
def save_the_prisoner(n: int, m: int, s: int) -> int:
Теги
math
Log ind for at se indsendelseshistorik
Log indLog ind for at bruge AI-mentor
Log indVisible tests
1
Input
5, 2, 1Expected
22
Input
5, 2, 2Expected
33
Input
7, 19, 2Expected
64
Input
3, 7, 3Expected
35
Input
1, 100, 1Expected
16
Input
10, 2, 2Expected
3Focus radio
Paused · SomaFM · Fluid