No.108 Triple Card Completion
タグ : / 解いたユーザー数 206
作問者 :
sugim48
Problem Statement
You are hooked on a trading card game called "yu☆ki☆oh".
This game has $N$ types of cards, and you already own some cards.
You want to complete your collection of all card types.
However, since this game allows up to $3$ cards of the same type in a deck, you want to collect at least $3$ cards of each type.
You buy cards $1$ at a time, and which type you get is completely random.
(Regardless of the cards you hold, each type is obtained with probability $1/N$.)
What is the expected number of cards you will buy until you complete your collection?
Input
$N$ $A_1$ $A_2$ $\ldots$ $A_N$
Line $1$ contains $N(1\leq N\leq100)$, the number of card types.
Line $2$ contains space-separated values $A_i(0\leq A_i\leq10)$, where each value is the number of cards of the $i$-th type you own.
Output
Output the expected value on one line.
Your answer is accepted if the absolute error or the relative error is at most $10^{-6}$.
Print a newline at the end.
Sample
Sample 1
Input
1 0
Output
3
Sample 2
Input
2 1 2
Output
4.5
Sample 3
Input
8 3 4 5 6 7 8 9 10
Output
0
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。