시간 제한메모리 제한제출정답맞힌 사람정답 비율
4 초 512 MB27242388.462%

문제

Here’s a jolly and simple game: line up a row of N identical coins, all with the heads facing down onto the table and the tails upwards, and for exactly K times take one of the coins, toss it into the air, and replace it as it lands either heads-up or heads-down. You may keep all of the coins that are face-up by the end.

Being, as we established last year, a ruthless capitalist, you have resolved to play optimally to win as many coins as you can. Across all possible combinations of strategies and results, what is the maximum expected (mean average) amount you can win by playing optimally?

입력

  • One line containing two space-separated integers:
    • N (1 ≤ N ≤ 400), the number of coins at your mercy;
    • K (1 ≤ K ≤ 400), the number of flips you must perform.

출력

Output the expected number of heads you could have at the end, as a real number. The output must be accurate to an absolute or relative error of at most 10−6.

예제 입력 1

2 1

예제 출력 1

0.5

예제 입력 2

2 2

예제 출력 2

1

예제 입력 3

2 3

예제 출력 3

1.25

예제 입력 4

6 10

예제 출력 4

4.63476563

예제 입력 5

6 300

예제 출력 5

5.5

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > The UK & Ireland Programming Contest > UKIEPC 2017 F번

  • 문제를 만든 사람: Robin Lee