Logo
(追記) (追記ここまで)

33335번 - Coconuts 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 2048 MB111100.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}$.

제한

  • 1ドル \leq n \leq 10$;
  • 1ドル \leq d_i \leq 10$;
  • 1ドル \leq k \leq \sum\limits_{i=1}^n d_i$.

예제 입력 1

3 2
1 3 3

예제 출력 1

0.666666666667

예제 입력 2

4 5
2 2 3 3

예제 출력 2

1.833333333333

노트

Here are the best strategies for examples:

  1. Hit a random coconut, then hit another one.
  2. Choose a coconut, hit it until it cracks, then switch to another until it cracks, etc.

출처

Camp > Petrozavodsk Programming Camp > Summer 2023 > Day 2: Nyatl Contest 2023 C번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /