#P4543. [JSOI2011] Apple 的美食
[JSOI2011] Apple 的美食
Description
Apple really likes eating chocolate, but it is a picky pig, and some kinds of chocolate cannot satisfy its taste. If the owner gives it chocolate that it does not like, it will be very unhappy. The owner does not know what kind of chocolate Apple likes, but she knows that the cocoa content is an important factor affecting a chocolate’s taste, so she decides to judge which chocolates to give Apple based on their cocoa content.
Assume that the cocoa content of a chocolate has different measured levels. She considers chocolates whose cocoa content lies in the range to be tasty. However, she does not know what this range is, and you need to help determine a range so that she can let Apple eat as many chocolates it likes as possible.
Let be the number of chocolates with cocoa butter content that Apple thinks are tasty, and let be the number of chocolates with cocoa butter content that Apple thinks are not tasty. These two sequences are generated as follows:
$$\begin{cases}pos_i=a_{2i-1}\\neg_i=a_{2i}\end{cases}$$where .
Let be the number of chocolates that Apple thinks are tasty and the owner also judges as tasty, be the number of chocolates that Apple thinks are not tasty and the owner also judges as not tasty, be the number of chocolates that Apple thinks are not tasty but the owner judges as tasty, and be the number of chocolates that Apple thinks are tasty but the owner judges as not tasty.
Let be the ratio of chocolates correctly judged as tasty among all truly tasty chocolates, and let be the ratio of chocolates correctly judged as tasty among all chocolates judged as tasty. Then
$$\begin{cases}r=\frac{TP}{TP+FN}\\p=\frac{TP}{TP+FP}\end{cases}$$Please help Apple find a range that maximizes .
Input Format
The input consists of multiple lines. Each line is one dataset: , separated by spaces.
The input ends with a single . The number of datasets does not exceed .
Output Format
For each dataset, output one line: the maximum value of (rounded to decimal places).
4 4 4 1 5
12 9 6 6 11
0
0.800000
0.683938
Hint
Constraints
For of the testdata, . It is guaranteed that there is at least one chocolate that Apple thinks is tasty.
Translated by ChatGPT 5
京公网安备 11011102002149号