P23652 [AtCoder] Dual Cut
普及+
题目描述

Problem Description

We decided to cut a wafer with radius $ R $ horizontally into $ N $ equal parts. A wafer is a thin circular disk used to make certain components.

There are $ N-1 $ cut lines to divide the wafer into $ N $ equal parts. The cut lines are numbered from 1 to $ N-1 $ from top to bottom. For convenience, we also consider cut lines with numbers $ 0 $ or greater than $ N $ as existing.

b7d93ccb848ebe7e3e1956b68b97625f.png

We will use a technique called dual cut to divide the wafer into $ N $ parts.

In a dual cut, we perform the cut operation several times on the cut lines. In one cut, we use two blades to cut two cut lines simultaneously. Due to the machine's constraints, the two cut lines must be sufficiently apart. More precisely, if the numbers of the two cut lines to be cut simultaneously are $i, j\ (i < j)$, then $i + M \leq j$ must be satisfied. It is allowed to cut the same cut line more than once or cut lines with numbers $ 0 $ or greater than $ N $.

The cut length when cutting the $ i $th and $ j $th cut lines simultaneously is represented by the length of the longer cut line. Here, the length of the $i\ (1 \leq i \leq N-1)$th cut line is the length of the segment common to the line indicated by the $ i $th cut line and the wafer, and the lengths of cut lines numbered $ 0 $ or $ N $ are $ 0 $.

Here is a specific example of machine operation. When $ N = 6 $ and $ M = 3 $, if we operate the machine with $ i = 2 $ and $ j = 5 $, the $ 2 $nd and $ 5 $th cut lines are cut as shown in the left figure below. The cut length in this case is the length of the $ 2 $nd cut line because it is longer than the $ 5 $th cut line. The lengths of the cut lines are shown by red solid lines in the figure. Note that an operation like $ i = 3, j = 5 $ as shown in the right figure below cannot be performed because it does not satisfy $i + M \leq j$.

25802968adbadeb2e8567108e61a5bdd.png

The wafer can be divided into $ N $ parts by cutting each of the $ 1 $st to $ N-1 $th cut lines at least once. We want to minimize the total cut length when dividing the wafer into $ N $ parts by operating the machine cleverly. Find the minimum total cut length.

Input Format

The input is given from the standard input in the following format:

$ R $ $ N $ $ M $

Output Format

Output the answer in one line. Absolute or relative errors within $ 10^{-6} $ are acceptable.

Sample Input and Output

Sample Input #1

100 4 1

Sample Output #1

373.2050807569

Sample Input #2

100 4 3

Sample Output #2

546.4101615138

Sample Input #3

43 65 12

Sample Output #3

2208.8155789165

Sample Input #4

1000 1000 999

Sample Output #4

1570743.7385010704

Notes/Hints

Constraints

  • $1 \leq R \leq 10^3$
  • $2 \leq N \leq 10^3$
  • $1 \leq M \leq N - 1$
  • $ R $ is an integer

Partial Points

  • If you solve the dataset satisfying $ M = 1 $, you will be awarded $ 300 $ points.
  • If you solve the dataset without additional constraints, you will be awarded an additional $ 400 $ points.

Sample Explanation 1

One of the optimal procedures to cut is as follows:
- Cut the $ 1 $st and $ 2 $nd cut lines.
- Cut the $ 0 $th and $ 3 $rd cut lines.
This case satisfies the partial points constraint.

Sample Explanation 2

One of the optimal procedures to cut is as follows:
- Cut the $ 0 $th and $ 3 $rd cut lines.
- Cut the $ 1 $st and $ 4 $th cut lines.
- Cut the $ 2 $nd and $ 5 $th cut lines.
Note that since $ M $ is $ 3 $ different from the first example, operations like cutting the $ 1 $st and $ 2 $nd lines simultaneously or the $ 1 $st and $ 3 $rd lines simultaneously are not allowed due to machine constraints.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
100 4 1
样例输出
373.2050807569