Supermean

“I have not failed. I’ve just found 10,000 ways that won’t work.” Thomas Edison Do you know how to compute the mean (or average) of n numbers? Well, that’s not good enough for me. I want the supermean! “What’s a supermean,” you ask? I’ll tell you. List the n given numbers in non-decreasing order. Now compute the average of each pair of adjacent numbers. This will give you n − 1 numbers listed in non-decreasing order. Repeat this process on the new list of numbers until you are left with just one number - the supermean. I tried writing a program to do this, but it’s too slow. :-( Can you help me? Input The first line of input gives the number of cases, N. N test cases follow. Each one starts with a line containing n (0 < n ≤ 50000). The next line will contain the n input numbers, each one between −1000 and 1000, in non-decreasing order. Output For each test case, output one line containing ‘Case #x:’ followed by the supermean, rounded to 3 fractional digits. Sample Input 4 1 10.4 2 1.0 2.2 3 123 5 12345 Sample Output Case #1: 10.400 Case #2: 1.600 Case #3: 2.000 Case #4: 3.000