These problems are from the atcoder DP contest, and were transferred onto DMOJ. All problem statements were made by several atcoder users. As there is no access to the test data, all data is randomly generated. If there are issues with the statement or data, please contact or on slack.
Let be a positive odd number.
There are coins, numbered
. For each
, when Coin
is tossed, it comes up heads with probability
and tails with probability
.
Taro has tossed all the coins. Find the probability of having more heads than tails.
Constraints
is an odd number.
.
is a real number and has two decimal places.
Input Specification
The first line will contain the integer .
The next line will contain floats,
.
Output Specification
Print the probability of having more heads than tails. The output is considered correct when the absolute error is not greater than .
Sample Input 1
3
0.30 0.60 0.80
Sample Output 1
0.612
Explanation For Sample 1
The probability of each case where we have more heads than tails is as follows:
- The probability of having
is
;
- The probability of having
is
;
- The probability of having
is
;
- The probability of having
is
;
Thus, the probability of having more heads than tails is .
Sample Input 2
1
0.50
Sample Output 2
0.5
Explanation For Sample 2
Outputs such as 0.500
, 0.500000001
and 0.499999999
are also considered correct.
Sample Input 3
5
0.42 0.01 0.42 0.99 0.42
Sample Output 3
0.3821815872
Comments
remember that doubles are automatically rounded to 6 decimal places during output
This is pretty tricky! The third sample keeps throwing me off.