No.67 A Common Stick-Cutting Problem (1)
タグ : / 解いたユーザー数 338
作問者 :
LayCurse
Problem Statement
Yuki has \(N\) sticks, and the length of the \(i\)-th stick is \(L_i\).
The sticks can be cut freely (in the direction that divides their length), but they cannot be joined together.
Yuki wants to make \(K\) sticks of the same length.
Write a program that finds the maximum possible length of the \(K\) sticks that can be made.
Input
\(N\) \(L_1\ L_2\ \cdots\ L_N\) \(K\)
All inputs are given as integers.
\(1 \leq N \leq 200000 = 2 \times 10^5\)
\(1 \leq L_i \leq 1000000000 = 10^9\)
\(1 \leq K \leq 10000000000 = 10^{10}\)
Output
Output the maximum possible length on \(1\) line.
The answer is considered correct if the absolute error or the relative error is at most $10^{-9}$.
Print a newline at the end.
Sample
Sample 1
Input
2 10 20 3
Output
10.00
By cutting the stick of length \(20\) exactly into \(2\) equal parts, you get \(3\) sticks of length \(10\).
Sample 2
Input
2 10 20 4
Output
6.666666666666667
By cutting the stick of length \(20\) into \(3\) equal parts, and cutting the stick of length \(10\) so that only a length of \(20/3\) remains and discarding the rest, you get \(4\) sticks of length \(20/3\).
Sample 3
Input
5 99 88 77 66 55 1
Output
99
Sample 4
Input
5 99 88 77 66 55 10
Output
33
Sample 5
Input
5 99 88 77 66 55 100000
Output
0.003849923001540
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。