#P6036. Ryoku 爱学习
Ryoku 爱学习
Background
Ryoku inherited Riri’s talent for studying, so she really loves studying. However, no matter how much she loves it, Ryoku can still get tired.
Problem Description
At time , Ryoku will learn that there is a new piece of knowledge . The actual value of this knowledge is . Since Ryoku loves studying, she will not choose to skip any knowledge, but she only has probability of successfully mastering this knowledge.
However, if Ryoku masters too much knowledge at the same time, due to factors such as her inner tiredness, Ryoku’s level of “liking” for knowledge will change. We use a value to describe the magnitude of this liking level. Specifically, let represent the total liking level for the knowledge from time to time that Ryoku masters continuously. With parameters (), we have:
Ryoku wants to know the expected total liking level of every continuous segment of time that she can master (note that the continuous segment here must not be contained in a longer one). Can you help her?
Input Format
The input contains three lines.
The first line contains an integer and two real numbers .
The second line contains integers, which are .
The third line contains real numbers, which are .
Output Format
Output one line containing one positive real number, which is the answer.
3 0.5 0.5
2 3 3
0.5 0.5 0.5
3.097
6 0.8 0.2
1 1 4 5 1 4
0.9 0.6 0.7 0.7 0.6 0.8
10.521
Hint
[Sample 1 Explanation]
When mastering knowledge , knowledge , and knowledge , the sum of liking levels over each continuously mastered segment is .
When mastering knowledge and knowledge , the sum of liking levels over each continuously mastered segment is $\left(\dfrac 12\right)^{\frac12\times 1}(2+3)=\dfrac {5\sqrt2}2\approx 3.536$.
When mastering knowledge and knowledge , the sum of liking levels over each continuously mastered segment is $\left(\dfrac 12\right)^{\frac12\times 0}\times 2 +\left(\dfrac 12\right)^{\frac12\times 0}\times 3 = 5$.
When mastering knowledge and knowledge , the sum of liking levels over each continuously mastered segment is $\left(\dfrac 12\right)^{\frac12\times 1}(3+3)=3\sqrt 2\approx 4.243$.
When only mastering knowledge , the sum of liking levels over each continuously mastered segment is $\left(\dfrac 12\right)^{\frac12\times 0}\times 2 = 2$.
When only mastering knowledge , the sum of liking levels over each continuously mastered segment is $\left(\dfrac 12\right)^{\frac12\times 0}\times 3 = 3$.
When only mastering “treasure” , the sum of liking levels over each continuously mastered segment is $\left(\dfrac 12\right)^{\frac12\times 0}\times 3 = 3$.
When mastering nothing, the sum of liking levels over each continuously mastered segment is .
The probabilities of the above cases are all , so the answer is approximately:
$$(4+3.536+5+4.243+2+3+3+0)\times \dfrac 18\approx3.0973$$[Constraints]
For of the testdata, .
For another of the testdata, .
For of the testdata, .
For another of the testdata, .
For another of the testdata, .
In addition, for of the testdata, , , . It is guaranteed that the input precision does not exceed .
This problem uses Special Judge. If, for some test point, the difference between your answer and the standard answer is less than or equal to , you can pass that test point.
Translated by ChatGPT 5