0.97497 +/- 0.00001

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

請您先登陸,再發跟帖!