문제
Problem 3: The Bessie Shuffle [Mark Gordon, 2013]
Bessie is practicing her card tricks. She has already mastered the Bessie- shuffle -- a shuffle on M
Now Bessie is practicing shuffles on larger decks. She has a deck of N cards
Bessie knows that the deck initially started in sorted order, with 1 on top, 2 next, and N on the bottom. Given the description of the Bessie-shuffle, help Bessie compute which cards end up located at Q different specified positions
입력
* Line 1: A single line containing N, M and Q separated by a space.
* Lines
* Lines
출력
* Lines 1..Q: On the
예제1
53 5
3
1
2
1
2
3
4
5
4
5
3
1
2
INPUT DETAILS:
Bessie has a deck of 5 cards initially ordered as
OUTPUT DETAILS:
The shuffle proceeds as:
This produces the final order of