#P1654. OSU!
OSU!
Description
osu is a popular casual game.
We can simplify and adapt its rules as follows:
There are operations. Each operation is either a success or a failure, where success is denoted by and failure by . The operations form a binary string of length . In this string, every maximal run of consecutive 's contributes points to the score (i.e., these ones must not be contained within a longer run of consecutive 's; see the sample explanation).
Given and the success probability of each operation, output the expected score, rounded to 1 decimal place.
Input Format
The first line contains a positive integer , the number of operations.
Each of the next lines contains a real number in , denoting the success probability of each operation.
Output Format
Output a single real number, the answer, rounded to 1 decimal place.
3
0.5
0.5
0.5
6.0
Hint
[Sample explanation]
has a score of , has a score of , has a score of , has a score of , has a score of , has a score of , has a score of , has a score of ,the total is , and the expectation is .
Constraints: .
Translated by ChatGPT 5
京公网安备 11011102002149号