There is a bridge that will collapse in 17 minutes. 4 people (A, B, C and D) are standing on one side of the bridge and want to cross it before it collapses. There are few restrictions, as below:
– A takes 1 minute
– B take 2 minutes
– C take 5 minutes, and
– D takes 10 minutes
to cross the bridge.
How can they all get across before the bridge blows up (i.e cross the bridge in 17 minutes)?
Solution to the problem is as follows:
Move | Time |
A & B Cross with torch | 2 |
A Return with torch | 1 |
C & D Cross with torch | 10 |
B Return with torch | 2 |
A & B Cross with torch | 2 |
———————— | ————– |
Total Time | 17 |
3 Comments
Please send me the c++ logic for this puzzle
https://cprogramforbridgeandtorchproblem.blogspot.com/2021/02/simplistic-c-program-for-bridge-and.html
https://cprogramforbridgeandtorchproblem.blogspot.com/2021/02/simplistic-c-program-for-bridge-and.html