#t438. 取牌游戏
取牌游戏
Bessie's Cards
Problem Description
Bessie is playing a card game with her friends (), using a deck of cards (; is a multiple of ). The deck contains good cards and bad cards. Bessie deals the cards, and of course she wants to take all the good cards for herself, because she likes to win.
Her friends suspect she will cheat, so they impose these rules:
(1) at the start, the top card is dealt to the person on Bessie's right;
(2) after each card is dealt, she must move the next cards (), one by one in order, to the bottom of the deck;
(3) continue dealing to every player in a counterclockwise order.
Bessie is eager to win. Help her work out the positions of all the good cards so that she can get them. The cards are numbered from top to bottom.
Input Format
One line with three space-separated integers: .
Output Format
lines: the positions of the good cards, in increasing order from the top.
Sample Input
3 9 2
Sample Output
3
7
8
Limitation
1 s, 1024 KiB for each test case.