시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
2 초 (추가 시간 없음) | 1024 MB | 25 | 21 | 19 | 86.364% |
Black and White is a Chinese children's game played in rounds. During each round, the children who are playing all put their hands in either face-up ("White") or face-down ("Black"). If all the children but one make the same choice, then the "odd one out" sits out for the rest of the game. Play continues until there are only two children left.
Each child independently chooses whether to put their hand face-up with their own fixed probability. What is the expected number of rounds that such a game will last?
The first line contains a single integer $n$ ($2 \le n \le 20$), which is the number of children.
Each of the next $n$ lines contains a single real number $p$ ($0.1 \le p \le 0.9$). These are the probabilities for each child that they will put their hand in face-up. The probabilities will have at most three digits after the decimal point.
Output a single real number, which is the expected number of rounds. The result must be accurate to within an absolute or relative error of $10^{-6}$.
3 0.5 0.5 0.5
1.3333333
3 0.3 0.3 0.3
1.5873015
5 0.1 0.3 0.5 0.7 0.9
7.4752846
ICPC > Regionals > North America > Pacific Northwest Regional > 2021 ICPC Pacific Northwest Region > Division 2 P번
ICPC > Regionals > North America > South Central USA Regional > 2021 South Central USA Regional Contest > Division 1 A번
ICPC > Regionals > North America > South Central USA Regional > 2021 South Central USA Regional Contest > Division 2 B번
ICPC > Regionals > North America > Mid-Central Regional > Mid-Central USA Programming Contest 2021 B번
ICPC > Regionals > North America > Southeast USA Regional > 2021 Southeast USA Regional Programming Contest > Division 1 A번
ICPC > Regionals > North America > Southeast USA Regional > 2021 Southeast USA Regional Programming Contest > Division 2 B번