Under construction

Still being built. Things may change

Safety in Numbers

Time limit5sMemory limit512 MB

Summary
Compute for each contestant the smallest vote percentage that guarantees another contestant ties or trails them no matter how the remaining votes split.
Level

Medium5 of 10

Topics
Math, Binary search, Sorting
Solved
No attempts yet

Problem

A reality TV show has NN contestants. Each contestant gets a score from the judges, and the audience vote is added on top of it to form a final score.

Let XX be the sum of the judge scores of all contestants. If a contestant received JJ points from the judges and a fraction YY of the audience vote, where 0≤Y≤10 \le Y \le 1 (for example 0.30.3), then that contestant's final score is J+X⋅YJ + X \cdot Y. The vote fractions of all contestants add up to exactly 11.

The contestant with the lowest final score is eliminated. If two or more contestants share the lowest score, nobody is eliminated.

Once contestant ii's vote fraction is fixed at YY, the remaining fraction 1−Y1 - Y can be split among the other contestants in any way, with a nonnegative amount for each of them. Given the judge scores, find for every contestant the smallest YY, as a percentage, that keeps that contestant out of elimination no matter how the remaining votes are split.

Input

The first line contains the number of test cases TT. Each of the next TT lines holds one test case. A line starts with the number of contestants NN, then a single space, then the judge scores s0,s1,…,sN−1s_0, s_1, \dots, s_{N-1} separated by single spaces. The value sis_i is the score contestant ii received from the judges.

Limits

  • 1≤T≤501 \le T \le 50
  • 2≤N≤2002 \le N \le 200
  • 0≤si≤1000 \le s_i \le 100
  • si>0s_i > 0 for at least one ii.

Output

Print one line per test case. The line starts with Case #x: , then the real numbers m0,m1,…,mN−1m_0, m_1, \dots, m_{N-1} separated by single spaces. Here xx is the test case number starting from 11, and mim_i is the smallest percentage of the audience vote contestant ii must secure to be certain of avoiding elimination.

Always print mim_i with exactly six digits after the decimal point. Round the exact value at the seventh digit after the decimal point, rounding up when that digit is exactly 55. A value of 00 prints as 0.000000 and a value of 100100 prints as 100.000000.

Examples1

  1. Example 1

    Input
    4
    2 20 10
    2 10 0
    4 25 25 25 25
    3 24 30 21
    
    Expected output
    Case #1: 33.333333 66.666667
    Case #2: 0.000000 100.000000
    Case #3: 25.000000 25.000000 25.000000 25.000000
    Case #4: 34.666667 26.666667 38.666667