問題一覧 > 通常問題

No.108 Triple Card Completion

レベル : / 実行時間制限 : 1ケース 5.000秒 / メモリ制限 : 512 MB / 小数誤差許容問題 絶対誤差または相対誤差が $10^{-6}$ 以下。ただし、ジャッジ側の都合で500桁未満にしてください
タグ : (AC するまで非表示) / 解いたユーザー数 206
作問者 : sugim48
お気に入りにしたユーザー ProblemId : 121 / 自分の提出
問題文最終更新日: 2026-06-27 03:49:25
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 68 (順位表) の他の問題:

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もしくは右上の雲マークをクリックしてアカウントを作成してください。