logo AlgoBeat OnlineJudge
登录 注册

#215940. [ICPC 2026 NAC] Draw Your Deck

内存限制:2048 MiB 时间限制:5000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

You are playing a single-player game with a deck of cards. The deck has cards, each with an integer between and written on it. You shuffle the deck and draw a card, which forms your starting hand. You then play the game by repeatedly choosing and discarding a card from your hand. Each time you do so, you draw as many cards from the top of the deck into your hand as the integer written on the card you just discarded. (If there are not enough cards left in the deck, you draw them all.) You win if you draw all of the cards from the deck and you lose if you run out of cards in your hand when there are still cards left in the deck. Given the contents of the deck, and assuming that all possible shuffles of the deck are equally likely and that you play optimally, what is the probability you win the game?

输入格式

The first line of input contains two space-separated integers and , where is the number of cards in the deck and is the largest integer written on any of the cards.

The second line contains space-separated integers , starting at : the number of cards in the deck with the integer written on them. It is guaranteed that and that the sum of all of the is .

输出格式

Print a real number: the probability that you win if you play optimally. Your answer will be accepted if it differs from the judge solution by an absolute error of at most .

样例

样例输入 1

4 2
2 0 2

样例输出 1

0.3333333333333333

样例输入 2

5 1
3 2

样例输出 2

0.0