• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Crossing a bridge

 
Ranch Hand
Posts: 539
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Four DJs are off to play at a party, but they have to cross a bridge. It's night time (of course), and they have only got one torch between them.
Unfortunately, the bridge is weak, so only two of them can cross at once. Also, they must carry the torch when they cross, so they can see where they're going.
Now, they can all walk at different speeds:
  • Hixxy can walk really fast, he can cross the bridge in 1 minute.
  • Sharkey can walk almost as fast, he takes 2 minutes.
  • Brisk is a lot slower, he takes 5 minutes.
  • Breeze is the slowest of the lot, he takes 10 minutes.


  • Importantly, when two walk together, they must walk at the speed of the slower person. They all have to cross the bridge.
    Now, the question...how fast can they do it? Can Sharkey make his gig, which starts in 17 minutes???
    Cheers,
    --Tim
    PS Extra Double Plus Bonus Points to anyone who listens to these guys *g*. PLUR.
    [ May 05, 2004: Message edited by: Tim West ]
     
    Greenhorn
    Posts: 1
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    19 mins...
    guy who takes 1 min will always be traversing back and forth,first he will take guy with 2 min ,return back then 5 min,and then 10 min....
     
    Ranch Hand
    Posts: 1907
    1
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I know the answer,it was a favourate question for companies during test.
     
    Tim West
    Ranch Hand
    Posts: 539
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Ram - Yeah, that's how I heard about it too (from a friend). Thanks for not ruining the fun by telling everyone !
    Rajiv - They can do better than that!
    Cheers,

    --Tim
     
    Tim West
    Ranch Hand
    Posts: 539
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Ahh too smart...took me ages to work it out
    Well done though!

    --Tim
     
    Ranch Hand
    Posts: 3404
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I just realised why I could do it, though.
    Posted a similar question myself in this very forum.
    So I'll delete my response and let someone else have a go.
    Nothing like practise making perfect.
     
    Ranch Hand
    Posts: 309
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    hmm. i arrived at 19 mins which seems to be pretty straightforward. but 17 mins
    can it happen that the fastest guy while returning need not have to walk the whole distance, the torch is ON and maybe when he is 1/2 way or 3/4 way, the guy from the opposite direction can start walking following the light thus saving time. is this allowed ? still thinking ......
    regards.
     
    Rancher
    Posts: 13459
    Android Eclipse IDE Ubuntu
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Nope, each person has to walk the whole way.
    Hint: Instead of modeling the solution around the fastest guy, what if you model it around the slowest?
     
    Greenhorn
    Posts: 16
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    i tutor 8th graders in toronto, ontario..Can you beleive it, it was one of their math puzzle assignments..So, yeah i know the answer but won't spoil it for other..Its NOT 19 though..
     
    lowercase baba
    Posts: 13091
    67
    Chrome Java Linux
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    It can be done in 17 minutes. the trick is to minimize the time for the 5 and 10 minute guys. But i don't want to give it away too easily.
     
    Ranch Hand
    Posts: 1923
    Scala Postgres Database Linux
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Well - in the last moment you could program a solution of brute force trying every possibility.
     
    pie sneak
    Posts: 4727
    Mac VI Editor Ruby
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    === bridge
    1 2 5 10 djs by speed
    > and < direction of movement
    5 10 === >1 2 *the fast djs go first (= 2min)
    5 10 1< === 2 *one takes the torch back (+ 1m = 3min)
    1 === >5 10 2 *the slow djs go (+ 10m = 13min)
    1 2< === 5 10 *then two brings it back (+ 2m = 15min)
    === >1 2 5 10 *one and two are left (+ 2m = 17min)
     
    Tim West
    Ranch Hand
    Posts: 539
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Well done :-)
    ...And no-one listens to these guys??? Y'all don't know what you're missing out on!!
    Hmm, I'm gonna find another problem to post :-D

    --Tim
     
    Oh, sure, you could do that. Or you could eat some pie. While reading this tiny ad:
    Smokeless wood heat with a rocket mass heater
    https://woodheat.net
    reply
      Bookmark Topic Watch Topic
    • New Topic