시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 128 MB | 292 | 224 | 208 | 76.753% |
A Perfect Shuffle of a deck of cards is executed by dividing the deck exactly in half, and then alternating cards from the two halves, starting with the top half.
Given a deck of cards, perform a Perfect Shuffle. If there is an odd number of cards, give the top half split one more card than the bottom half.
There will be several test cases in the input. Each test case will begin with a line with a single integer n (1≤n≤1,000), indicating the number of cards. On each of the next n lines will be a string from 1 to 80 characters in length, which is the name of a card. It will contain only capital letters and dashes. Within a test case, all card names will be unique. Input will end with a line with a single 0.
For each test case, output n lines, consisting of the deck after a perfect shuffle. Output no extra spaces. Do not print a blank line between answers.
4 ACE KING QUEEN JACK 5 SKIP DRAW-TWO REVERSE WILD WILD-DRAW-FOUR 0
ACE QUEEN KING JACK SKIP WILD DRAW-TWO WILD-DRAW-FOUR REVERSE