From be52b98e7dbb8f7d7f5094255929ebdc13002bb3 Mon Sep 17 00:00:00 2001 From: PEN <12828106+new_pen@user.noreply.gitee.com> Date: Thu, 25 Jan 2024 04:27:02 +0000 Subject: [PATCH] =?UTF-8?q?add=20=E6=9C=80=E7=9F=AD=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=8C=91=E6=88=98/pi=5Ffen.py.=20range(n)=20n=E8=B6=8A?= =?UTF-8?q?=E5=A4=A7pi=E8=B6=8A=E7=B2=BE=E7=A1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: PEN <12828106+new_pen@user.noreply.gitee.com> --- .../pi_fen.py" | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 "\346\234\200\347\237\255\344\273\243\347\240\201\346\214\221\346\210\230/pi_fen.py" diff --git "a/\346\234\200\347\237\255\344\273\243\347\240\201\346\214\221\346\210\230/pi_fen.py" "b/\346\234\200\347\237\255\344\273\243\347\240\201\346\214\221\346\210\230/pi_fen.py" new file mode 100644 index 0000000..2e07290 --- /dev/null +++ "b/\346\234\200\347\237\255\344\273\243\347\240\201\346\214\221\346\210\230/pi_fen.py" @@ -0,0 +1,2 @@ +import random as r +print(4*sum(1 for _ in range(1000000) if r.uniform(-1, 1)**2 + r.uniform(-1, 1)**2 <= 1)/1000000) \ No newline at end of file -- Gitee