Throwing cards away
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
Given an ordered deck of cards numbered from to with card at the top and card at the bottom. The following operation is performed as long as there are at least two cards in the deck: throw away the top card and move the card that is now on the top of the deck to the bottom of the deck. Your task is to find the sequence of discarded cards and the last, remaining card.
Input
Each line contains number of cards in the deck. The last line contains and should not be processed.
Output
For each input number produce two lines. The first line presents the sequence of discarded cards, the second line reports the last remaining card. See the sample for the expected format.
Examples
Input #1
Answer #1
Submissions 3K
Acceptance rate 54%