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

來源: piffle 2010-09-29 12:31:33 [] [舊帖] [給我悄悄話] 本文已被閱讀: 次 (658 bytes)
回答: 回複:求救!咋樣,可以成攻救人?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

請您先登陸,再發跟帖!

發現Adblock插件

如要繼續瀏覽
請支持本站 請務必在本站關閉/移除任何Adblock

關閉Adblock後 請點擊

請參考如何關閉Adblock/Adblock plus

安裝Adblock plus用戶請點擊瀏覽器圖標
選擇“Disable on www.wenxuecity.com”

安裝Adblock用戶請點擊圖標
選擇“don't run on pages on this domain”