jmu-python-生日悖论

import random

x,n=map(int,input().split())
random.seed(x)
f=0
for i in range(n):
    s=set()
    for j in range(23):
        c=random.randint(1,365)
        s.add(c)
    if len(s)<23:
        f+=1
    
print("rate={:.2f}".format(f/n))

 

posted @ 2020-06-21 16:31  tf383838  阅读(711)  评论(0编辑  收藏  举报