其实用程序来解决是非常容易的
import random
from math import *
n=1000
m=0
for i in range(n):
x=random.random()
y=random.random()
z=sqrt(x**2+y**2)
if z<=1.0:
m+=1
pi=4*(m/n)
print("PI=",pi)
如有更好的解决办法可在评论区发表,或者邮箱发给作者
邮箱:official@songboyi.top