Bridge and torch Problem
From http://en.wikipedia.org/wiki/Bridge_and_torch_problem
Bridge Problems
Said, it was dark and four people had to bridge the bridge. They had only one torch. A bridge can only let two people pass at a time, and because it is dark, people crossing the bridge must have a torch. It is known that the time required for crossing A, B, C, and D is 1, 2, 5, or 8 (minutes). Find the shortest time required for crossing a bridge.
Method 1:
Obviously, every time two people pass, one person must come back to deliver the torch. The cost of returning is unavoidable, so we will let people who bridge the bridge back in one minute, so that the waste of time is the shortest.
Elapsed time |
Start Point |
Action |
Endpoint |
0 |
A B c d |
|
|
2 |
C d |
A and B in the past, it took 2 minutes |
A B |
3 |
A c d |
A: It will take 1 minute. |
B |
8 |
D |
A and C used to take 5 minutes. |
A B C |
9 |
A D |
A: It will take 1 minute. |
B c |
17 |
|
A and D used to take 8 minutes. |
A B c d |
Therefore, this solution takes 17 minutes.
Method 2:
If the slowest person passes, the time consumed by two people is only one time. So let the slowest two people pass. Let the shortest run before, and then he takes back the torch.
Elapsed time |
Start Point |
Action |
Endpoint |
0 |
A B c d |
|
|
2 |
C d |
A and B in the past, it took 2 minutes |
A B |
3 |
A c d |
A: It will take 1 minute. |
B |
11 |
A |
C and D Cross used to take 8 minutes |
B c d |
13 |
A B |
B. It takes 2 minutes. |
C d |
15 |
|
A and B in the past, it took 2 minutes |
A B c d |
This solution takes 15 minutes.