Coconuts
시간 제한3초메모리 제한2048 MB
코코넛별 내구도는 알지만 어느 코코넛이 어느 내구도인지 모를 때, 정확히 k번의 타격으로 깨뜨릴 수 있는 코코넛 수의 기댓값을 최대로 만든다.
문제
Consider coconuts and an array describing them. The value is the durability of the -th coconut. It means that the -th coconut will be cracked after hits.
Then the coconuts were shuffled, so it is now impossible to determine which coconut has which durability.
Your goal is to crack as many coconuts as possible using exactly hits. What is the expected number of cracked coconuts if you use the best possible strategy?
For each hit, you can arbitrarily select one coconut and hit it. After that, you see if the coconut has cracked or not.
입력
The first line contains two integers and : the number of coconuts and the number of hits required, respectively.
The second line contains integers : durabilities of coconuts.
출력
Output one real number which denotes the expected number of cracked coconuts if you use the best possible strategy. The relative or absolute error of the result should not exceed .
제한
- ;
- ;
- .
힌트
Here are the best strategies for examples:
- Hit a random coconut, then hit another one.
- Choose a coconut, hit it until it cracks, then switch to another until it cracks, etc.