시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 1024 MB874100.000%

문제

Your friend Ómar's favourite video game is Striker-Count. But he has now grown tired of actually playing the game and is more interested in the lootboxes found in the game. Inside each lootbox there is an item of some level of rarity. Ómar is only interested in acquiring the rarest items in the game. When he starts the game, he chooses two numbers $n$ and $k$, such that $k \leq n$. He then opens lootboxes in the game until $k$ of the last $n$ lootboxes included an item of the highest rarity.

This activity amuses Ómar, but does not interest you in the slightest. You are more interested in the numbers: you know that each lootbox Ómar opens has probability $p$ of containing an item of highest rarity, independently for each lootbox. You want to find the expected number of lootboxes Ómar will open before concluding his process.

입력

The only line of the input contains the two integers $n$ and $k$ ($1 \le k \le n \le 6$), and the real number $p$ ($0 < p \le 1$ and $p$ has at most four decimals after the decimal point), with meanings as described above.

출력

Output the expected number of lootboxes Ómar must open, with a relative error of at most $10^{-6}$. It is guaranteed that the input is such that this expected number does not exceed $10^9$.

예제 입력 1

3 2 0.0026

예제 출력 1

74445.39143490087

예제 입력 2

6 1 0.0026

예제 출력 2

384.61538461538464

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > Nordic Collegiate Programming Contest > NCPC 2021 F번

  • 문제를 만든 사람: Bergur Snorrason