import random
import time
random.seed()
nums=100000
i=range(1,nums)
s=0
for x in i:
for y in i:
a1=random.random()
a2=random.random()
if (a1*a1+a2*a2)<1:
s=s+1
print 1.0*s/(nums*nums)*4
print time.strftime('End:%Y-%m-%d %H:%M:%S',time.localtime(time.time()))
阅读(852) | 评论(0) | 转发(0) |