#### Archived

This topic is now archived and is closed to further replies.

# "Easy" problem needs a clever solution. Can you give it?

This topic is 5438 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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:
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]

##### Share on other sites
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

##### Share on other sites
sounds like homework to me...

##### Share on other sites
The greedy algorithm is as good as any other ''efficient'' algorithm, never being more than 22% suboptimal (clicky).

##### Share on other sites
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.

##### Share on other sites

This topic is 5438 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

This topic is now closed to further replies.

1. 1
Rutin
28
2. 2
3. 3
4. 4
5. 5

• 13
• 11
• 10
• 13
• 20
• ### Forum Statistics

• Total Topics
632948
• Total Posts
3009405
• ### Who's Online (See full list)

There are no registered users currently online

×