#P1577. Cutting Ropes Equally

    ID: 14863 Type: Default 1000ms 256MiB

Cutting Ropes Equally

Cutting Ropes Equally

You are given N ropes with lengths \(L_i\). The task is to cut these ropes into K pieces such that each piece has the same maximum possible length. The answer should be the maximum length each piece can have, with the result truncated (not rounded) to two decimal places.

Formally, you are to find the maximum real number \(x\) such that:

[ \sum_{i=1}^{N} \left\lfloor \frac{L_i}{x} \right\rfloor \ge K ]

where \(\lfloor \cdot \rfloor\) denotes the floor function. Print the answer with exactly two decimal places, by directly truncating digits after the second decimal place.

inputFormat

The first line contains two numbers: N (the number of ropes) and K (the number of pieces needed).

The second line contains N numbers denoting the lengths of the ropes: L1 L2 ... LN. The lengths can be decimal numbers.

outputFormat

Output a single line containing the maximum possible length for each of the K pieces, truncated to two decimal places.

sample

3 5
5.00 2.00 4.00
2.00