All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Logic
Bridge Cross Baffle (Posted on 2016-10-10) Difficulty: 3 of 5
Six friends Al, Ben, Cal, Dan, Elmer and Frank want to cross a bridge. It is a very dark night but there is only one torch between the six of them. The bridge is narrow so that only two people at a time can cross it. It is known that:

Al takes exactly 1 minute to cross the bridge.
Ben takes exactly 2 minutes to cross the bridge.
Cal takes exactly 4 minutes to cross the bridge.
Dan takes exactly 7 minutes to cross the bridge.
Elmer takes exactly 12 minutes to cross the bridge.
Frank takes exactly 19 minutes to cross the bridge.

When two people cross the bridge, they do so with the pace of the slower person.

Determine the minimum amount of time it will take all six friends to cross the bridge.

No Solution Yet Submitted by K Sengupta    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Wouldda, Coudda, Shouldda done it by computer Comment 3 of 3 |
Successively better times:

AB A AC A AD A AE A AF 48
AB A AC A AD A AF A AE 48
AB A AC A AD A EF B AB 39
AB A AC A AD B EF A AB 39
AB A AC A EF B AB A AD 39
AB A AC A EF B AD A AB 39
AB A AC B EF A AB A AD 39
AB A AC B EF A AD A AB 39
AB A AD A AC A EF B AB 39
AB A AD A AC B EF A AB 39
AB A AD A EF B AB A AC 39
AB A AD A EF B AC A AB 39
AB A AD B EF A AB A AC 39
AB A AD B EF A AC A AB 39
AB A CD B AB A EF B AB 38
AB A CD B AB B EF A AB 38
AB A EF B AB A CD B AB 38
AB A EF B AB B CD A AB 38
AB B CD A AB A EF B AB 38
AB B CD A AB B EF A AB 38
AB B EF A AB A CD B AB 38
AB B EF A AB B CD A AB 38

where the pairs of letters are across and single letters back. Each is followed by the time.

DefDbl A-Z
Dim crlf$, leftMemb(6), rightMemb(6), totTime, minTime, h$



Private Sub Form_Load()
 Form1.Visible = True
 leftMemb(0) = 6
 leftMemb(1) = 1
 leftMemb(2) = 2
 leftMemb(3) = 4
 leftMemb(4) = 7
 leftMemb(5) = 12
 leftMemb(6) = 19
 
 rightMemb(0) = 0
 
 minTime = 9999
 
 Text1.Text = ""
 crlf = Chr$(13) + Chr$(10)
 
 xfer
 
 
 Text1.Text = Text1.Text & crlf & " done"
  
End Sub

Sub xfer()
  For i = 1 To 5
   If leftMemb(i) > 0 Then
    rightMemb(i) = leftMemb(i)
    leftMemb(i) = 0
    For j = i + 1 To 6
     If leftMemb(j) > 0 Then
       rightMemb(j) = leftMemb(j)
       leftMemb(j) = 0
       leftMemb(0) = leftMemb(0) - 2
       rightMemb(0) = rightMemb(0) + 2
       totTime = totTime + rightMemb(j)
       h = h + Mid("ABCDEF", i, 1) + Mid("ABCDEF", j, 1) + " "
       
       If rightMemb(0) = 6 Then
         If totTime <= minTime Then
           minTime = totTime
           Text1.Text = Text1.Text & h & minTime & crlf
         End If
       Else
         For k = 1 To 6
          If rightMemb(k) > 0 Then
            leftMemb(k) = rightMemb(k)
            rightMemb(k) = 0
            leftMemb(0) = leftMemb(0) + 1
            rightMemb(0) = rightMemb(0) - 1
            totTime = totTime + leftMemb(k)
            h = h + Mid("ABCDEF", k, 1) + " "
            
            xfer
            
            h = Left(h, Len(h) - 2)
            leftMemb(0) = leftMemb(0) - 1
            rightMemb(0) = rightMemb(0) + 1
            rightMemb(k) = leftMemb(k)
            leftMemb(k) = 0
            totTime = totTime - rightMemb(k)
          End If
          
         Next k
       
       End If
         
       h = Left(h, Len(h) - 3)
       totTime = totTime - rightMemb(j)
       leftMemb(0) = leftMemb(0) + 2
       rightMemb(0) = rightMemb(0) - 2
       leftMemb(j) = rightMemb(j)
       rightMemb(j) = 0
     End If
    Next
    leftMemb(i) = rightMemb(i)
    rightMemb(i) = 0
   End If
  Next
End Sub

  Posted by Charlie on 2016-10-10 15:45:39
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (3)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2017 by Animus Pactum Consulting. All rights reserved. Privacy Information