回複:回複:求救!咋樣,可以成攻救人?

回答: 回複:求救!咋樣,可以成攻救人?guest0072010-09-28 18:06:11

Assume:

P1 is the person that needs 1 minute to cross
P2 is the person that needs 2 minutes to cross
P5 is the person that needs 5 minutes to cross
P10 is the person that needs 10 minutes to cross

A is one side of the bridge and B is the other side.

Beginning state: A(P1, P2, P5, P10) - B()

Step 1: A(P5, P10) - B(P1, P2) ==> 2 min : this means P1 and P2 cross the bridge together, use 2 minutes

Step 2: A(P1, P5, P10) - B(P2) ==> 1 min

Step 3: A(P1) - B(P2, P5, P10) ==> 10 min

Step 4: A(P1, P2) - B(P5, P10) ==> 2 min

Step 5: A() - B(P1, P2, P5, P10) == > 2 min

Total : 17 min

所有跟帖: 

Another solution: switching P1 and P2 also works -newers- 給 newers 發送悄悄話 newers 的博客首頁 (0 bytes) () 10/03/2010 postreply 07:32:54

請您先登陸,再發跟帖!