The Grand Cook OffProblem code: COOKOFF2 |
All submissions for this problem are available.
Chef is planning a grand cooking tournament for aspiring chefs in the region. The competition progresses with a number of one-on-one elimination rounds until only one chef remains. For each round, two chefs are chosen at random for a cook-off. The loser of the cook-off is elimited, while the winner moves on. Additionally, each chef begins with a positive number of prize tokens (some chefs begin with more than others, based on their performance in a qualification round). The winner of each cook-off receives all of the loser's prize tokens, and the loser is awarded a prize based on the number of prize tokens he/she had accrued.
The final cook-off always receives the most publicity. Your task it to compute the expected difference between the number of prize tokens of the final two competitors before the final cook-off. You will be given the number of tokens each chef begins with.
Input
Input begins with an integer T, the number of test cases (at most 50). Each test case consists of a single line, beginning with an integer C, the number of chefs in the competition, followed by C positive integers each describing the number of prize tokens a chef begins with. The total number of prize tokens among all chefs will be between 1 and 100, inclusive.
Output
For each test case, output the expected difference in prize tokens, rounded to 6 places after the decimal point.
Sample Input
3 3 1 1 1 3 1 1 2 4 10 10 10 30
Sample Output
1.000000 1.333333 26.666667
| Author: | pieguy |
| Date Added: | 7-04-2011 |
| Time Limit: | 1 sec |
| Source Limit: | 50000 Bytes |
| Languages: | ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.0.0-8, CPP 4.3.2, CS2, D, ERL, F#, FORT, GO, HASK, ICK, ICON, JAR, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.1.2, RUBY, SCALA, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC |
Comments
SUCCESSFUL SUBMISSIONS FOR THIS PROBLEM:
HELP
Program should read from standard input and write to standard output. After you submit a solution you can see your results by clicking on the [My Submissions] tab on the problem page. Below are the possible results:
- Accepted
Your program ran successfully and gave a correct answer. If there is a score for the problem, this will be displayed in parenthesis next to the checkmark. - Time Limit Exceeded
Your program was compiled successfully, but it didn't stop before time limit. Try optimizing your approach. - Wrong Answer
Your program compiled and ran succesfully but the output did not match the expected output. - Runtime Error
Your code compiled and ran but encountered an error. The most common reasons are using too much memory or dividing by zero. For the specific error codes see the help section. - Compilation Error
Your code was unable to compile. When you see this icon, click on it for more information.
If you are still having problems, see a sample solution here.

Fetching successful submissions

> The total number of prize
Yes, we caught this during
Yes, we caught this during the contest and clarified that C is at least 2.