railroad bridge
a man needs to go through a train tunnel. he starts through the tunnel and when he gets 1/4 the way through the tunnel, he hears the train whistle behind him. you don't know how far away the train is, or how fast it is going, (or how fast he is going). all you know is that
if the man turns around and runs back the way he came, he will just barely make it out of the tunnel alive before the train hits him.
if the man keeps running through the tunnel, he will also just barely make it out of the tunnel alive before the train hits him.
assume the man runs the same speed whether he goes back to the start or continues on through the tunnel. also assume that he accelerates to his top speed instantaneously. assume the train misses him by an infintisimal amount and all those other reasonable assumptions that go along with puzzles like this so that some wanker doesn't say the problem isn't well defined.
how fast is the train going compared to the man?
Intuition is tells you something's wrong here. And we're left to : either give some logical hand waving, or a chip mathematical proof. let's do both.
handwaving : if (first scenario) the train gets to the end of the tunnel exactly when the guy finishes to run as fast as he can a quarter of a tunnel, the train gets to the beginning of the tunnel much earlier, so no chance he escapes in the opposite direction (for which, he must pass 3/4 of the tunnel).
25 cents math proof : distance between train and beginning of the tunnel is x and length of the tunnel is y.
first scenario says :
the time for the train to get x+y is the same as the time for the man to turn around and pass 0.25y so :
(x+y)/v1=0.25y/v2
second scenario :
x/v1=0.75y/v2
let's arrenge them differently : ratio=v1/v2
4x/y=3*ratio
4x/y+4=ratio
so(subtracting):
2*ratio=4
ratio<0
which isn't possible because that means either the guy or the train runs in the opposite direction of what we meant.
since we don't want this we must conclude that no valid (positive) answer is available.
Avi Gozolchiani
Saturday, November 30, 2002
You got your 25cent math proof slightly wrong. Here's a slightly informal version.
Distance between train and beginning of tunnel is x and length of tunnel is y.
Man starts at pos y/4.
Train goes x distance in time man runs y/4
Train goes x+y in time man runs 3y/4
So Train goes x+yx distance in time man runs 3y/4  y/4
Train goes y distance in time man runs 2y/4 = y/2
Train goes twice as fast as man.
Paul Viney
Monday, December 02, 2002
I have to strongly disagree with you. Ah, damn someone's just posted the answer. I agree that the train goes twice the speed of the man, though I didn't use anything like as elegent a method as Paul.
Avi, the mistake you made was to assume that the train gets to the end of the tunnel in scenario 1, whereas it gets to the beginning of the tunnel, so it should be x/v1 = 0.25y/v2.
Cheers,
manzo
manzo
Monday, December 02, 2002
Why math? I'd prefer just to draw simple solution on grid paper, but since there are no images here let's use some twist:
Imagine the poor man splits in two and both halves run to both ends of tunnel. When half number one meets the train at the tunnel entrance, half number two is halfway (ugh) to the exit and it will be at the exit the same moment train hits it. Here you go: man did halftunnel while train passed whole length.
PS: It is an "aha" question, unless you are interviewing an architect who should think of all processes in the system at once, or multythreaded developer ;)
DK
Tuesday, December 17, 2002
oops. Julian Hall had exactly same answer.
DK
Tuesday, December 17, 2002
Recent Topics
Fog Creek Home
