You are working at a factory and are in charge of the software of a machine that cuts sheets of glass. A sheet of glass is divided into little areas each one with an imperfection score, where 0 means perfect and larger means more imperfections. For example:
A larger glass sheet:
0.0, 0.1, 0.0, 0.4, 0.8, 0.2, 0.3, 0.1
Your task is to cut the larger glass sheet into smaller pieces of length L, such that the total sum of imperfections is less than or equal to I. The level of imperfection of a smaller piece of glass is the sum of the imperfections of the areas inside it. We want the number of smaller glasses to be maximal.
Continuing with the example:
For L = 2, I = 0.4, you can cut the larger piece into 3 pieces that match the quality constraint.
(0.0, 0.1), (0.0, 0.4), 0.8, 0.2, (0.3, 0.1)
Your program should output the largest number of glass sheets that can be produced, in this case is 3
Your input is:
Output:
Integer telling me how many compliant smaller pieces can be cut.