#C1126. Maximum Equal-Length Pencils
Maximum Equal-Length Pencils
Maximum Equal-Length Pencils
You are given N pencils with various lengths and a target length L. Your task is to determine the maximum number of equal-length pencil pieces you can obtain by cutting each pencil into segments of length L (without any leftover processing). In other words, for each pencil with length l, you can obtain \( \lfloor l / L \rfloor \) pieces. The final answer is the sum of all these values.
Input Format: The first line contains two integers N and L. The second line contains N integers representing the lengths of the pencils.
Example: If the input is:
4 2 4 7 9 10
Then the output should be \(2 + 3 + 4 + 5 = 14\).
inputFormat
The input is received from standard input (stdin) and has the following format:
- The first line contains two integers N and L, where N is the number of pencils and L is the length of each piece after cutting.
- The second line contains N space-separated integers representing the lengths of the pencils.
outputFormat
Output the maximum number of equal-length pieces that can be obtained. The output should be written to standard output (stdout) as a single integer.
## sample4 2
4 7 9 10
14