#P7033. Typing Contest
Typing Contest
Problem Description
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.
Input
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$.
Output
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