# maximizing sum of a 3 numbers to

There are n lines of length 90 inches which need to be cut at 1/2 places so that the new parts formed after cut have a total length as close as possible to 90.

Conditions

the minimum length is 24 and maximum is 48.
the length to be cut are decided on input

example we need

6 lines of 24
5 of 26
4 of 28
7 of 32
8 of 37
9 of 38
7 of 40
6 of 42
....


There for total line segments after cut = 6+5+4+7+8+9+7+6 = 42 which would need around 12 lines of 90" ..

how to cut them to minimize wastage e.g

If I cut 26+28 +32 = 86, I waste 4". How to keep the wastage to minimum?

-

## migrated from stackoverflow.comNov 20 '12 at 12:39

This question came from our site for professional and enthusiast programmers.

Did not read care fully, but either rod cutting problem or knapsack could worth a look. –  Nishant Oct 29 '12 at 16:25
This seems like the cutting stock problem. –  interjay Oct 29 '12 at 16:27
thanks @interjay. Problem Solved :) –  Akshat Goel Oct 29 '12 at 16:29