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

建议使用的浏览器:

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

7033:Typing Contest

题目描述
Teacher docriz is planning to select some students in his class for a typing contest.

There are $n$ students in the class. The $i$-th classmate's initial typing speed is $s_i$ and the typing noise is $f_i$. However, when several students are selected to compete, their total typing speed is not the sum of everyone's initial typing speed, because the noise each person makes affects others.

Specifically, if students $1, 2, 3, \cdots, k$ form a team, the actual typing speed of student $1$ is $s_1 \times (1 - f_1f_2 - f_1f_3 - \cdots - f_1f_k)$, and the actual typing speed of $2$ is $s_2\times (1-f_2f_1-f_2f_3-\cdots-f_2f_k)$, and so on.

Teacher docriz wants to form a team so that the total typing speed is as large as possible. Please help him calculate the maximum typing speed he could possibly achieve.
输入解释
The first line contains an integer $T(1 \leq T \leq 1000)$ - the number of test cases. Then $T$ test cases follow.

The first line of each test case contains a single integer $n(1 \leq n \leq 100)$ - the number of students.

Then $n$ lines follow, each line contains $2$ numbers $s_i, f_i(1 \leq s_i \leq 10^{12}, 0 \leq f_i \leq 1)$, where $s_i$ is an integer and $f_i$ is a real number with $\pmb{\text{exactly 2 decimal places}}$.

It is guaranteed that $\sum n < 1.2 \times 10^4,\sum n^2 < 2.4 \times 10^5, \sum n^3 < 1.2 \times 10^7, \sum n^4 < 9 \times 10^8$.
输出解释
For each test case, output a single real number - the maximum typing speed that teacher docriz can achieve. Keep your answers to $\pmb{\text{exactly 9 decimal places}}$.

It is guaranteed that there is no precision error in the answer when $9$ decimal places are reserved, so we don't have special judge for this problem. $\pmb{\text{Please ensure the accuracy of your output}}$.
输入样例
4
3
10 0.00
11 0.00
12 0.00
3
10 1.00
11 1.00
12 1.00
3
10 0.50
11 0.50
12 0.50
3
10 0.33
11 0.21
12 0.92
输出样例
33.000000000
12.000000000
17.250000000
20.421900000

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

源链接: HDU-7033

最后修改于 2021-10-23T19:11:08+00:00 由爬虫自动更新

共提交 0

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