Bridge crossing riddle

Problem Four people must cross a bridge at night with one torch. At most two may cross at a time, a crossing party moves at the slower member's speed, and the torch must accompany every crossing (someone must bring it back). With individual times of 1, 2, 5, and 10 minutes, find the minimum total time for all four to cross.

Input / Output

  • Input: crossing times (classically 1, 2, 5, 10).
  • Output: minimum total time and the crossing schedule.

Example

  • The known optimum for (1,2,5,10) is 17 minutes.
asked …
LeaderboardSalaryAccount