当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3815:Stones

题目描述
There are N piles of stones on the desk at the beginning and N -1 rounds follows. For each round, two piles are chosen at random and we merge them into a new pile. If the new pile has K stones, then we will get K*K points.
For example, there are three piles of stones and they have 2, 5 and 4 stones respectively. If in the first round we merge the first pile and the third pile, a new pile with 6 stones are created and we will get 6*6=36 points. The second round we will create a new pile with 11 stones and get 121 points. Now we get 157 points in total. Similarly, we will get 170 points if we merge the first pile and the second pile and will get 202 points if we merge the second pile and third pile. The expected points we will get is (157+170+202)/3 = 176.333333.
Your task it to compute the expected points we will get after N-1 rounds.
输入解释
The first line contains an integer T indicating the number of test cases.
The first line of each test case contains an integer N indicating the number of piles. The second line contains N integers Ai indicating the size of each pile.

Technical Specification
1. 1<=T<=50
2. 1<=N <=100
3. 1<=Ai<=1000
输出解释
For each test case, output the case number first, then the expected points we will get
rounded to 2 digits after the decimal point..
输入样例
3
1
100
2
3 4
3
2 5 4
输出样例
Case 1: 0.00
Case 2: 49.00
Case 3: 176.33
来自杭电HDUOJ的附加信息
Author hanshuai
Recommend lcy

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-3815

最后修改于 2020-10-25T23:07:14+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 32768/32768K(Java/Others)