UVA12912 Josephus lottery

Description

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=862&page=show_problem&problem=4777 [PDF](https://uva.onlinejudge.org/external/129/p12912.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12912/250c44941ee43f447180f5ee3ed2e73b447f61cb.png)

Input Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12912/ce310c7d5a81fd396d2f37feef65b7c8b7710491.png)

Output Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12912/4f448215c959cf34cd00f2be3ba0b0d12216e244.png)