0.97497 +/- 0.00001

來源: 布衣之才 2011-02-14 13:09:38 [] [博客] [舊帖] [給我悄悄話] 本文已被閱讀: 次 (257 bytes)

Set hits = 0

iterations:

{

Randomly pick four numbers x1, y1, x2, y2 between 0 and 1

if (x2-x1)^2 + (y2-y1)^2 > 1,  increment hits by 1

}

probability = hits / iterations

 

所有跟帖: 

你的答案夠準確了.精確答案:Pi-13/6=0.974925986 -Blue_Diamond- 給 Blue_Diamond 發送悄悄話 (0 bytes) () 02/14/2011 postreply 23:50:20

請您先登陸,再發跟帖!

發現Adblock插件

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

關閉Adblock後 請點擊

請參考如何關閉Adblock/Adblock plus

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

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