2548. Deal or No Deal

单点时限: 2.0 sec

内存限制: 256 MB

On the show Deal or No Deal, a player plays a game against the house. There are 26 suitcases each containing different amounts of money from $0.01 to $1,000,000. The player knows the amounts but does not know which suitcase contains what amount.

First, the player picks a suitcase that (s)he will keep unopened until the end of the game. Then, (s)he opens other cases, one by one and reveals the amount of money inside. At several points during the game, the banker (who works for the house) will offer him/her the choice of stopping the game and accepting a money offer.

The offer amount is calculated by a computer program. The task is to write that program. The program should always make an offer that is equal to the expected amount of money in the player’s suitcase.

输入格式

The first line of input gives the number of cases, N. N test cases follow. Each one starts with a line containing n (1<=n<=26) - the number of unopened suitcases remaining, including the player’s suitcase. The next line will contain a1 through an - the money amounts in those suitcases, in some unknown order.

All suitcases will contains different amounts. Only the following amounts are allowed.

$0.01 $1 $5 $10 $25 $50 $75 $100 $200$300 $400 $500 $750 $1,000 $5,000 $10,000 $25,000 $50,000 $75,000 $100,000 $200,000 $300,000 $400,000 $500,000 $750,000 $1,000,000

输出格式

For each test case, output one line containing “Case #x:” followed by the offer made by the banker, rounded to two significant digits.

样例

Input
5
2
0.01 1000000
1
100
3
50 200 750
2
0.01 1
1
0.01
Output
Case #1: $500000.00
Case #2: $100.00
Case #3: $330.00
Case #4: $0.51
Case #5: $0.01

2 人解决,14 人已尝试。

2 份提交通过,共有 32 份提交。

9.8 EMB 奖励。

创建: 15 年前.

修改: 6 年,8 月前.

最后提交: 3 年,5 月前.

来源: partychen

题目标签