# UVa 10935 - Throwing cards away I
[題目連結](http://domen111.github.io/UVa-Easy-Viewer/?10935)
## 題目敘述
Given is an ordered deck of n cards numbered 1
to n with card 1 at the top and card n at the
bottom. The following operation is performed as
long as there are at least two cards in the deck:
:::success
給你一個包含 $n$ 張牌的牌堆,最上面那張編號為 $1$,依序編號直到最底下的牌編號為 $n$。
接下來的操作在牌堆至少還剩 $2$ 張牌以上時,會被反覆執行:
:::
Throw away the top card and move
the card that is now on the top of the
deck to the bottom of the deck.
:::success
丟棄放在最頂端的牌,之後將最頂端的牌放至牌堆最底下。
:::
Your task is to find the sequence of discarded
cards and the last, remaining card.
:::success
你的任務是找出棄牌的序列,以及最後留下來的那張牌。
:::
## 輸入格式
Each line of input (except the last) contains a
number n ≤ 50. The last line contains ‘0’ and
this line should not be processed.
:::success
除了最後一行外,每一行會包含一個數字 $n \le 50$。
最後一行將會包含 `0` 且這行不需要被處理。
:::
## 輸出格式
For each number from the input produce two
lines of output. The first line presents the sequence of discarded cards, the second line reports the last remaining card. No line will have
leading or trailing spaces. See the sample for the
expected format.
:::success
對輸入的每個數字,輸出兩行文字。
第一行描述棄牌序列,第二行則回報最後剩下的牌。
每行都不該存在任何行首或行尾的空白。
參考範例以了解詳細格式。
:::
## Sample Input
```
7
19
10
6
0
```
## Sample Output
```
Discarded cards: 1, 3, 5, 7, 4, 2
Remaining card: 6
Discarded cards: 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 4, 8, 12, 16, 2, 10, 18, 14
Remaining card: 6
Discarded cards: 1, 3, 5, 7, 9, 2, 6, 10, 8
Remaining card: 4
Discarded cards: 1, 3, 5, 2, 6
Remaining card: 4
```
{%hackmd @sa072686/__style %}
###### tags: `翻譯`, `UVa`