Codeforces Round 1086 (Div. 2)
C
Stamina and Tasks
Codeforces
1300
原题
← BD1 →
翻译中…

There are $n$ tasks for you. Task $i$ has an integer value of $c_i$ and a difficulty of $p_i$. Also, you have an initial stamina of $1$, which is denoted as $S$. You should process the tasks from task $1$ to task $n$. For each task, you have two choices.

翻译中…
  • Give up the task. This way, nothing will happen.
  • Complete the task. This way, you will gain $S\cdot c_i$ points. However, $S$ will drop to $S\cdot (1-\frac{p_i}{100})$ after the task is completed.
翻译中…

You need to maximize your points after you finish the process.

翻译中…

Input

翻译中…

Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 10^3$). The description of the test cases follows.

翻译中…

The first line of each test cases contain an integer $n$ ($1\le n\le10^5$) denoting the number of tasks.

翻译中…

The following $n$ lines contain two integers each, denoting $c_i$ ($1\le c_i\le 100$) and $p_i$ ($0\le p_i\le 100$).

翻译中…

It is guaranteed that the sum of $n$ over all test cases does not exceed $10^5$.

翻译中…

Output

翻译中…

For each test case, output a single real number — the maximum possible points you can get. Your answer is considered correct if its absolute or relative error does not exceed $10^{-6}$.

翻译中…

Formally, let your answer be $a$, and the jury's answer be $b$. Your answer is accepted if and only if $\frac{|a−b|}{\max(1,|b|)}\le 10^{-6}$.

翻译中…

Note

翻译中…

In the first test case, it's optimal to complete task $1$ and $2$ in order, gaining points of $10+20=30$.

翻译中…

In the second test case, it's optimal to complete task $1$, give up task $2$, and complete task $3$. Before completing task $3$, your stamina has dropped to $1-\frac{5}{100}=0.95$. So your gain is $10+20\cdot 0.95=29$ points in total.

翻译中…

样例

Input #1
2
2
10 0
20 5
3
10 5
10 80
20 5
Output #1
30.0000000000
29.0000000000
InputCopy OutputCopy
题目信息
题号
2208C
时间限制
2 s
内存限制
256 MB
标签
动态规划
贪心
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。