Advertisement
tpaper

Untitled

Sep 2nd, 2012
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.32 KB | None | 0 0
  1. import random
  2. giorni = 365
  3. persone = 1122
  4. tentativi = 100000
  5. n=0
  6. for a in range(0,tentativi):
  7.   p = []
  8.   for b in range(0,persone):
  9.     p.append(random.randint(1,giorni))
  10.   for b in range(1,giorni+1):
  11.     if b not in p:
  12.       n=n+1
  13.       break
  14.      
  15. print n
  16. print (1.0-(float(n)/float(tentativi)))*100.0,'%'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement