Type Length (m) Number of Tubes Wanted
1 3 63
2 13 31
3 8 47
4 6 39
What's the minimum number of 20m tubes you must cut, in case to produce the above table?
Note: You are permitted to use a leftover part as a main part. E.g. Take a 20m tube, cut one 8m tube from it. Take the leftover part (12m) and cut it to 2 tubes, each one 6m (or 4 -> 3m). So from 1 tube which was 20m, we produced 1 tube 8m, and 2 tubes 6m.
If possible, give your solution, through an algorithm.
Enjoy...
HellRaiZer
EDIT : Some corrections
[edited by - HellRaiZer on November 28, 2003 5:09:20 PM]
"Easy" problem needs a clever solution. Can you give it?
Hello...
I have a little problem, which i want to share with you. Here it is:
Assume you have infinite number of identical tubes, all of them 20m. You are permitted to cut as many as you want, in case to produce the following "types" of tubes:
My solution...
63 20m tubes cut in the following fashion
31 @ 13 | 6
4 @ 8 | 6 | 6
16 @ 8 | 8 | 3
11 @ 8 | 3 | 3 | 3 | 3
1 @ 8 | 3 | 3 | 3
I couldn''t come up with a equation... so I don''t have any way of proving that this is the best way.
-Shags
63 20m tubes cut in the following fashion
31 @ 13 | 6
4 @ 8 | 6 | 6
16 @ 8 | 8 | 3
11 @ 8 | 3 | 3 | 3 | 3
1 @ 8 | 3 | 3 | 3
I couldn''t come up with a equation... so I don''t have any way of proving that this is the best way.
-Shags
The greedy algorithm is as good as any other ''efficient'' algorithm, never being more than 22% suboptimal (clicky).
Thread closed. The original question does seem very much like homework, so I have to assume that it is homework.
See Forum FAQ for info on the forum''s homework policy.
Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
See Forum FAQ for info on the forum''s homework policy.
Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement