#K34892. Maximizing Wooden Plank Pieces
Maximizing Wooden Plank Pieces
Maximizing Wooden Plank Pieces
You are given n wooden planks and an integer L representing the minimum acceptable length for each piece. Your task is to determine the maximum number of pieces (each of at least length L) that can be obtained by cutting the planks without any waste other than the leftover from each division.
For each wooden plank with length p, you can obtain \( \left\lfloor \frac{p}{L} \right\rfloor \) pieces. Sum the pieces over all planks to get the final result.
Input Format: The input is read from standard input. The first line contains two integers n and L separated by a space. The second line contains n integers representing the lengths of the wooden planks.
Output Format: Output a single integer, the maximum number of pieces obtainable, to the standard output.
Note: Use integer division, and ensure that each piece is at least of length L.
inputFormat
The first line of input contains two space-separated integers: n (the number of wooden planks) and L (the minimum required length for each piece). The second line contains n space-separated integers representing the lengths of the wooden planks.
outputFormat
Output a single integer which is the maximum number of pieces that can be obtained from the wooden planks with each piece having a length of at least L.
## sample5 2
5 8 6 3 7
13
</p>