P5308 [COCI 2018/2019 #4] Akvizna

Description

You are facing a challenge from $n$ contestants, and in the end you must defeat all of them. In each round, some contestants are eliminated. You will receive a share of the prize pool for that round equal to the ratio $\dfrac{\text{number eliminated in this round}}{\text{total number of opponents in this round}}$. For example, if there are $10$ opponents in a round and $3$ are eliminated, then you will receive $\dfrac{3}{10}$ of the prize pool. Assume the prize pool in every round is 1 unit of money. Mirko wants to win the competition in exactly $k$ rounds. What is the maximum total prize he can get? You only need to output the answer rounded to $9$ decimal places.

Input Format

One line with two positive integers $n,k$.

Output Format

Output one line with one real number representing the answer.

Explanation/Hint

### Explanation of Sample 1: The best situation is: Eliminate $3$ people in the first round, and eliminate $1$ person in each of the remaining two rounds. The total prize is $\frac{3}{5}+\frac{1}{2}+\frac{1}{1}=2.1$. ### Constraints: For $20\%$ of the testdata, $1\le n\le 100$. For $40\%$ of the testdata, $1\le n \le 3000$. For $100\%$ of the testdata, $1\le k \le n \le 10^5$. This problem is quite strict about precision. Please be careful. Translated by ChatGPT 5