-->
当前位置:首页 > 题库

PROGRAMMING:JMU Python birthday paradox

Luz5年前 (2021-05-10)题库393
Birthday paradox means that if there are 23 or more people in a room, the probability that at least two people have the same birthday is greater than 50%. Try programming verification.
**Verification method prompt: * use integer from 1 to 365 to represent birthday. Test n times, each time generate 23 random numbers, random numbers range from 1 to 365 (including 365).
Then check for duplicate birthdays.
Finally, calculate the repetition rate.
###Input format:
Random number seed x test times n
Note: you need to convert x to integer and then set it.
###Output format:
`Rate = calculated ratio, with 2 decimal places reserved
###Input example:
```in
3 1000
```
###Output example:
```out
rate=0.54
```






answer:If there is no answer, please comment