#K106. Maximum K-length Sticks
Maximum K-length Sticks
Maximum K-length Sticks
You are given n sticks with various lengths. Your task is to determine the maximum number of smaller sticks of a fixed length k that can be obtained by cutting the given sticks.
For each stick of length L, you can obtain \(\lfloor L/k \rfloor\) sticks of length k (where \(\lfloor \cdot \rfloor\) denotes the floor function). The total number of k-length sticks is the sum of \(\lfloor L/k \rfloor\) over all the sticks.
Note: The cuts do not produce any extra material and you cannot join pieces to form a new stick.
inputFormat
The first line contains two space-separated integers n
and k
, where n
is the number of sticks and k
is the desired length of each smaller stick.
The second line contains n
space-separated integers representing the lengths of the sticks.
It is guaranteed that all input values are positive integers.
outputFormat
Output a single integer representing the maximum number of k-length sticks that can be obtained.
## sample5 3
10 13 15 18 24
26