아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

StopCard

시간 제한1초메모리 제한1024 MB

요약
서로 다른 n개의 카드 값과 기준 c가 주어질 때, 기록 갱신 시 멈추는 전략의 기대 점수를 모든 무작위 순열에 대해 계산한다.
난이도

보통10점 중 6점

유형
확률, 조합론, 수학
정답자
아직 제출이 없습니다

문제

Jacob is playing a very odd solo card game called StopCard. In this game, the deck consists of nn cards where every card has one unique integer written on one side of it. The deck is shuffled randomly before the game is played. During each turn of the game, Jacob can choose to either take a card off the top of the deck and read that value, or not take a card off the deck and end the game. His final score for the game is the value of the last card taken from the deck. The deck will always have at least one card, and the first turn of the game must always be to draw the top card of the deck.

Jacob has a basic understanding of optimal stopping theory, so he devises a plan to play the game somewhat effectively. His plan is to keep drawing cards for a predetermined number (cc) of times, then to keep going until he sees a card that is larger than all the cards he previously saw, then to stop. His score will be the value written on that card. If he never sees a larger value on a card than the first cards he skipped, he would continue drawing until the deck runs out and would be left with a score equal to the number on the last card in the deck.

What is Jacob's expected score under this strategy?

입력

The input consists of a single test case. The first line contains two integer numbers nn and cc denoting the number of cards in the deck (0<n≤640 < n \le 64) and cc is the number of cards Jacob will definitely draw (0≤c<n0 \le c < n). The second line contains nn distinct integer numbers a_ia\_i (0≤a_i≤10,0000 \le a\_i \le 10\\,000) - the numbers written on the cards in the deck, which may be given in any order.

출력

Output the expected score under Jacob's strategy. Your answer will be considered correct if its absolute or relative error does not exceed 10−510^{-5}.

예제4

  1. 예제 1

    입력
    2 1
    0 1
    
    예상 출력
    0.500000
    
  2. 예제 2

    입력
    4 2
    0 4 8 6
    
    예상 출력
    5.500000
    
  3. 예제 3

    입력
    15 7
    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
    
    예상 출력
    11.266667
    
  4. 예제 4

    입력
    5 0
    10000 9832 3242 2 42
    
    예상 출력
    4623.6