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

建议使用的浏览器:

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

5645:DZY Loves Balls

题目描述
DZY loves playing balls.

He has $n$ balls in a big box. On each ball there is an integer written.

One day he decides to pick two balls from the box. First he randomly picks a ball from the box, and names it $A$. Next, without putting $A$ back into the box, he randomly picks another ball from the box, and names it $B$.

If the number written on $A$ is strictly greater than the number on $B$, he will feel happy.

Now you are given the numbers on each ball. Please calculate the probability that he feels happy.
输入解释
First line contains $t$ denoting the number of testcases.

$t$ testcases follow. In each testcase, first line contains $n$, second line contains $n$ space-separated positive integers $a_i$, denoting the numbers on the balls.

($1\le t\le 300, 2\le n \le 300,1\le a_i \le 300$)
输出解释
For each testcase, output a real number with 6 decimal places.
输入样例
2
3
1 2 3
3
100 100 100
输出样例
0.500000
0.000000
来自杭电HDUOJ的附加信息
Recommend wange2014

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

源链接: HDU-5645

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

共提交 0

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