[問題] cutting sticks

看板Prob_Solve (計算數學 Problem Solving)作者 (無法顯示)時間12年前 (2012/02/22 17:58), 編輯推噓1(105)
留言6則, 3人參與, 最新討論串1/2 (看更多)
suppose that we cut a stick of length L (a positive integer) with the probability P at each position such that its distance from the left end is a positive integer. design an efficient dynamic programming algorithm for calculating the probability that a stick of length at least n remains. 我手中的答案是 令F(k,n)為把長度k的木棒 切出有一條長度至少為n木棒的機率 F(k,n) = 0, if 1<=k<=n-1 F(k,n) = 2PF(k-1,n) + (1-P)^(k-1), if k>=n 請問這個式子是怎麼導出來的? 謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.228.24.240

02/22 18:15, , 1F
2*p*f(k-1,n): 最左邊切一刀或最右邊切一刀, 用剩下的k-1
02/22 18:15, 1F

02/22 18:15, , 2F
長木棍切出n長
02/22 18:15, 2F

02/22 18:16, , 3F
(1-p)^{k-1}: 這k-1個間隔都不切,剩下長度自然也≧n
02/22 18:16, 3F

02/22 19:47, , 4F
是說這遞迴式看起來好怪...真的是對的嗎 ?
02/22 19:47, 4F

02/22 19:57, , 5F
不清楚耶 因為這是別人解的 請問s大會怎麼寫呢?
02/22 19:57, 5F

02/22 20:25, , 6F
或許是(1-P)^(k-1) ?
02/22 20:25, 6F
文章代碼(AID): #1FHBnRBx (Prob_Solve)
討論串 (同標題文章)
文章代碼(AID): #1FHBnRBx (Prob_Solve)