#P13318. [GCJ 2012 #1B] Safety in Numbers

    ID: 15183 远端评测题 3000ms 1024MiB 尝试: 0 已通过: 0 难度: 4 上传者: 标签>数学2012二分Special JudgeGoogle Code Jam

[GCJ 2012 #1B] Safety in Numbers

题目描述

There are NN contestants in a reality TV show. Each contestant is assigned a point value by the judges and receives votes from the audience. The point value given by the judges and the audience's votes are combined to form a final score for the contestant, in the following way:

Let xx be the sum of the judge-assigned point values of all contestants. Now suppose a contestant got jj points from the judges, and that she received a fraction yy (between 0 and 1, inclusive) of the audience's votes (yy might be, for example, 0.3). Then that contestant's final score is j+xyj + x \cdot y. Note that the sum of all contestants' audience vote fractions must be 1.

The contestant with the lowest score is eliminated.

Given the points contestants got from judges, your job is to find out, for each contestant, the minimum percentage of audience votes he/she must receive in order for him/her to be guaranteed not to be eliminated, no matter how the rest of the audience's votes are distributed.

If the lowest score is shared by multiple contestants, no contestants will be eliminated.

输入格式

The first line of the input gives the number of test cases, TT. TT test cases follow, one per line. Each line starts with an integer NN, the number of contestants, followed by a space, followed by NN integers s0,s1,...,sN1s_0, s_1, ..., s_{N-1}, separated by single spaces. The integer sis_i is the point value assigned to contestant ii by the judges.

输出格式

For each test case, output one line containing "Case #x: " followed by NN real numbers: mim_is. The value xx is the case number (starting from 1). The value mim_i is the smallest percentage of audience votes required for contestant ii to definitely avoid elimination.

Answers within an absolute or relative error of 10510^{-5} of the correct answer will be accepted.

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

提示

Limits

  • 0si1000 \leq s_i \leq 100.
  • si>0s_i > 0 for some ii. This means at least one contestant will have a point value greater than 00.

Test set 1 (10 Pts, Visible Verdict)

  • 1T201 \leq T \leq 20.
  • 2N102 \leq N \leq 10.

Test set 2 (11 Pts, Hidden Verdict)

  • 1T501 \leq T \leq 50.
  • 2N2002 \leq N \leq 200.