loj#P6856. 「ICPC World Finals 2021」自由标记的手牌
「ICPC World Finals 2021」自由标记的手牌
Description
There is a fairly well-known mentalism trick known as the Fitch Cheney trick. From a deck of playing cards, are selected uniformly at random and given to an assistant while the magician is out of the room. The assistant places of the selected cards on a table, face up, and the single remaining card face down. The cards are placed in a single row with the face-down card at the end (see the picture for an example). The magician enters the room, looks at the cards on the table, and announces what the card is, although its face is hidden. The trick is typically done with and .
The assistant uses two ways of passing information to the magician. First, they can pick which one of the cards to keep hidden. Second, they can rearrange the other cards in a specific way. For the case and both techniques are needed, since there are only ways of rearranging four cards, which is not enough to reliably signal the fifth card. It is an interesting exercise to come up with a simple, easy-to-remember strategy for executing this trick, but right now you have another concern.
You were planning to perform this trick today, but just now you have learned that the deck has more cards than you expected. The trick may be impossible! In desperation, you have decided to cheat a little. You have distinguishable ways of marking the backs of the playing cards. You have marked the backs of all cards, allowing you to narrow down the possibilities for the card. For example, if there are cards marked with a particular method, and you see that the back of the kth card is marked with that method, you know it must be one of those cards.
Determine the probability that you will successfully guess the card, assuming you and the assistant execute an optimal (but likely very complicated!) strategy.
Input
The input contains one line with several integers. The first integer gives (), the number of cards that will be selected. The second integer gives (), the number of ways of marking the cards. The line is completed by positive integers, giving the number of cards marked with each distinct method. The sum of these integers is (), which is the size of the deck.
Output
Output the highest possible probability of guessing the card correctly, accurate up to an absolute error of .
4 1 28
0.96
3 3 5 12 3
0.854385964912