[OT] Quiz of the Day [2008-11-04]

Christopher Wright dhasenan at gmail.com
Wed Nov 5 15:57:17 PST 2008


Here's a problem that I encountered, and solved to my satisfaction.

There's an escalator taking people into a fiery pit of death. Your task 
is to save people.

These people are sorted according to race, creed, color, and nation. 
Each has a different weight. You can check the weight of each 
individual, and you know ahead of time the total weight of the people on 
the escalator.

You've got a guy on a tether hanging from your dirigible. You can do two 
things:
  - Tell him to grab onto the person directly under the dirigible. He'll 
hang on to them until you tell him to do otherwise.
  - Reel in the person he's hanging on to.

There are a few issues:
  - Your dirigible has a weight limit.
  - Each person has a different weight. There's a maximum weight for a 
person, but your dirigible isn't guaranteed to be able to hold that much.
  - You're an equal opportunity savior, so you want to take people at 
roughly even intervals, if possible.
  - People's weights are arranged adversarially.

How do you do it?



More information about the Digitalmars-d mailing list