|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|5 초||512 MB||9||7||4||80.000%|
There is a pool of numbers which are arbitrary decimal fractions from the interval (0, 1). In the first round of the game the middle third of the interval disappears, and the numbers from this interval are eliminated from the pool. In the next rounds the middle thirds of each of the remaining intervals disappear. In the first round the the interval [1/3, 2/3] is eliminated and in the second round the two intervals [1/9, 2/9] and [7/9, 8/9] are eliminated, and so on. The endpoints of each removed interval are removed as well.
Your role is to sort the pool of numbers in the order that they are eliminated. If some numbers are never eliminated, list them last. In case of a tie, list the smaller numbers first.
The first line of input will contain T, the number of test cases. T test cases will follow. Each one will start with a line containing an integer N. N numbers will follow, one per line. Each number will start with "0.", followed by one or more decimal digits. Each number will be larger than zero and will not have any trailing zeros.
For each test case, print the line "Case #x:", where x is the number of the test case, starting with 1. After that line, list the numbers, one per line, in order of elimination.
3 2 0.12 0.5 2 0.9 0.1 3 0.00449602349 0.10613259697 0.3283702389
Case #1: 0.5 0.12 Case #2: 0.1 0.9 Case #3: 0.00449602349 0.10613259697 0.3283702389
In case #1, 0.5 is eliminated in the first round because it falls into the interval [1/3, 2/3]. After the first round, there are two intervals remaining: (0, 1/3) and (2/3, 1). The number 0.12 is eliminated in round 2 because it falls into the interval [1/9, 2/9].