题解 | 泊松分布概率计算器

泊松分布概率计算器

https://www.nowcoder.com/practice/62cefdecf3554378a8c2cd9f77faa13c

import math
from scipy.stats import poisson

def poisson_probability(k, lam):
	"""
	Calculate the probability of observing exactly k events in a fixed interval,
	given the mean rate of events lam, using the Poisson distribution formula.
	:param k: Number of events (non-negative integer)
	:param lam: The average rate (mean) of occurrences in a fixed interval
	"""
	# Your code here

	return round(poisson.pmf(k,lam),5)
	

if __name__ == "__main__":
    k, lam = map(int, input().split())
    print(poisson_probability(k, lam))

全部评论

相关推荐

03-04 07:14
门头沟学院 C++
黑皮白袜臭脚体育生:老板:都给工作机会了还想要工资,哪来这么多好事
点赞 评论 收藏
分享
04-27 15:01
早稲田大学 Java
牛客72191338...:可能是时间点的问题,四月底机会确实会相对少点,但佬这个学历摆在这,会有机会的
简历中的项目经历要怎么写
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务