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
PostgreSQLv16

Hawn jidher ir-riżultat tat-tħaddim tal-kodiċi

Visible tests
1
Input
5, 2, 1
Expected2
2
Input
5, 2, 2
Expected3
3
Input
7, 19, 2
Expected6
4
Input
3, 7, 3
Expected3
5
Input
1, 100, 1
Expected1
6
Input
10, 2, 2
Expected3
Focus radio
Paused · SomaFM · Fluid