am1x

tmp006.py

Feb 26th, 2026
7,796
0
Never
2
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.28 KB | Cryptocurrency | 0 0
  1. import random
  2.  
  3. def proc(n):
  4.     s1 = 0
  5.     lims = [3, 3, 0]
  6.     for _ in range(n):
  7.         for i in range(len(lims)):
  8.             s = 0
  9.             while True:
  10.                 if random.choice((0, 0, 1)):
  11.                     break
  12.                 s += 1
  13.             if s >= lims[i]:
  14.                 s1 += s
  15.                 break
  16.     return s1
  17.  
  18.  
  19. n = 1000000
  20. m = proc(n)
  21. print(n, m, m / n)
  22.        
  23.        
  24.  
Tags: Alex
Advertisement