抛硬币正面期望
Problem statement:
问题陈述:
Let N be a positive odd number. There are N coins, numbered 1, 2 , ... , N. For each i (1≤i≤N), when Coin i is tossed, it comes up heads with probability pi and tails with probability 1-pi.
令N为正奇数。 有N个硬币,编号为1,2,...,N 。 对于每个i ( 1≤i≤N ),当投入硬币i时,它的出现概率为pi出现在正面 ,出现的概率为1-pi出现在尾部。
Find the probability of having more heads than tails if coins are tossed.
找到抛硬币后正面多于尾的概率。
Input:
输入:
The first line contains N, number of coins. The second line contains the probability of coming head in the coins.
第一行包含N个硬币数量。 第二行包含进入硬币的概率。
Output:
输出:
Output the probability of having more number of heads than tails if coins are tossed.
如果抛硬币,则输出正面比背面多的概率。
Example with explanation:
带有说明的示例:
Input:
N=3
[0.30, 0.60, 0.80]
Output:
0.612
The probability of having (Coin1,Coin2,Coin3) = (Head,Head,Head)
is 0.3×0.6×0.8 =