题目描述
Yesterday, the CS Club hosted a massive party that put all the frat parties to shame. Today, they have to clean up everything. They also have to restock the strategic supply of Mountain Dew. Phillip hates cleaning and wants to pick up the dew instead. He knows that they intend to distribute the chores by having everyone get a number between 1 and the number of people who actually stayed to help clean up. Once everyone has a number, they will start with the person who has number "1" and skip some number of people. The person who they land on will be given a specific cleaning task. The last person picked will not have to clean and will instead get the Dew. Help Phillip avoid work by creating a program that will take in the number of people participating and the number skipped and output which number Phillip should get in order to the last to get a chore.
Input
The number of people playing and the number being skipped.
Output
The number that will be picked last.
Tips:
Here is a website that visualizes this problem
Example
Input:
41 3
Output:
31
Explanation
Example case 1. ...
输入格式
见题面
输出格式
见题面