| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 3 초 | 2048 MB | 1 | 1 | 1 | 100.000% |
Consider $n$ coconuts and an array $d$ describing them. The value $d_i$ is the durability of the $i$-th coconut. It means that the $i$-th coconut will be cracked after $d_i$ 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 $k$ 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 $n$ and $k$: the number of coconuts and the number of hits required, respectively.
The second line contains $n$ integers $d_1, d_2, \ldots, d_n$: 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 10ドル^{-6}$.
3 2 1 3 3
0.666666666667
4 5 2 2 3 3
1.833333333333
Here are the best strategies for examples: