-2

Input: I have a master length of 10m and I have products that need to be cut in 3m, 4m, 5m dimensions.

I tried writing an algorithm that will generate the following table for me (optimal lengths):

3m 4m 5m Waste
3  0  0  1
2  1  0  0
1  0  1  2
0  1  1  1
0  2  0  2
0  0  2  0

I understand how it works but I don't know how to turn this into code.

I need some pseudocode or help with this (am I supposed to use recursion)?

4

1 に答える 1