ZOJ 3696 Alien's Organ 概率论 泊松分布
看了好久的题,但还是看得一脸蒙圈,感觉完全无从下手,我的队友告诉我可能是正太分布之类的,但我感觉不太像,后来才听同学说是泊松分布,才恍然大悟,概率论刚刚学过这里不久,不禁感叹,学会了还要会用啊。。。
泊松分布的参数λ是单位时间(或单位面积)内随机事件的平均发生率。 泊松分布适合于描述单位时间内随机事件发生的次数,与题目描述相应和,单位时间就是天, λ 是一天内随机事件的平均发生率。求<=n的概率,做一次求和就好了。
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
using namespace std;
double get(int x,double lan)
{
double fenmu = 1.0;
for(int i = ;i <= x;i++)
{
fenmu *= i;
}
return exp(-lan) * pow(lan,x) / fenmu;
}
int main()
{
int t,n;
double k;
scanf("%d",&t);
while(t--)
{
scanf("%d%lf",&n,&k);
double ans = 0.00;
for(int i = ;i <= n;i++)
{
ans += get(i,k);
}
printf("%.3lf\n",ans);
}
return ;
}
泊松分布的期望和方差均为
ZOJ 3696 Alien's Organ 概率论 泊松分布的更多相关文章
- ZOJ 3696 Alien's Organ
泊松分布.... Alien's Organ Time Limit: 2 Seconds Memory Limit: 65536 KB There's an alien whose name ...
- ZOJ 3696 Alien's Organ(泊松定理,期望值)
Alien's Organ Time Limit: 2 Seconds Memory Limit: 65536 KB There's an alien whose name is Marja ...
- zoj 3696 Alien's Organ(泊松分布)
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3696 Alien's Organ Time Limit: 2 S ...
- ****K - Alien's Organ
K - Alien's Organ Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%lld & %llu Sub ...
- ZOJ3696 Alien's Organ 2017-04-06 23:16 51人阅读 评论(0) 收藏
Alien's Organ Time Limit: 2 Seconds Memory Limit: 65536 KB There's an alien whose name is Marja ...
- zoj3696(泊松分布)
p(k)=(y^k) / (k!) * e^(-y) 其中的y就是平均值 k就是我们要求的大小. Alien's Organ Time Limit: 2 Seconds Memory Lim ...
- 【概率论】5-4:泊松分布(The Poisson Distribution)
title: [概率论]5-4:泊松分布(The Poisson Distribution) categories: - Mathematic - Probability keywords: - Po ...
- 概率论中常见分布总结以及python的scipy库使用:两点分布、二项分布、几何分布、泊松分布、均匀分布、指数分布、正态分布
概率分布有两种类型:离散(discrete)概率分布和连续(continuous)概率分布. 离散概率分布也称为概率质量函数(probability mass function).离散概率分布的例子有 ...
- zoj3696Alien's Organ (二项分布,泊松分布求近似值)
/*二项分布即重复n次的伯努利试验,每次发生的概率一样,假设成功的概率是p,那么失败的概率就是1-p: 二项分布的概率公式:试验中发生K次的概率是 P(ξ=K)= C(n,k) * p^k * (1- ...
随机推荐
- 常用的css
产品鼠标经过加边框效果 .productsCol:hover { box-shadow: 0 0 0 3px #333333 inset; transition: all 0.2s ease 0s; ...
- 文本输入框和下拉菜单特效-用正则表达式验证E-mail格式
———————————————————————————— <script type="text/javascript"> ...
- hdu_4651_Partition(公式)
题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=4651 题意:给你一个数n,让你输出将n拆分的方案数. 题解:公式题,不解释,当模版记住就行 #incl ...
- Python实战:爬虫的基础
网络爬虫(又被称为网页蜘蛛,网络机器人,在FOAF社区中间,更经常的称为网页追逐者),是一种按照一定的规则,自动地抓取万维网信息的程序或者脚本.另外一些不常使用的名字还有蚂蚁.自动索引.模拟程序或者蠕 ...
- iOS:UIWebView scrollView 的分页滑动问题
最近在弄一个native webview+html的项目,感觉这种尝试还是挺不错的,特被是适合内容类app.如杂志.电子书等.其实native搭的就是一个框架,主体还是在html的内容上,所以花在ht ...
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;方法意思
这个方法是用来设置你的TableView中每一行显示的内容和格式的. indexPath 用来指示当前单元格,它的row方法可以获得这个单元格的行号,section方法可以获得这个单元格所处的区域号 ...
- [nginx] 网上最全面nginx教程(近100篇文章整理)
转载:http://bbs.linuxtone.org/thread-25588-1-1.html Nginx基础 1. nginx安装 2. nginx 编译参数详解 3. nginx安装配置 ...
- Hibernate创建SessionFactory实例
private static SessionFactory sessionFactory = null; static { Configuration configuration =new Con ...
- C++中的函数指针和函数对象总结
篇一.函数指针函数指针:是指向函数的指针变量,在C编译时,每一个函数都有一个入口地址,那么这个指向这个函数的函数指针便指向这个地址.函数指针的用途是很大的,主要有两个作用:用作调用函数和做函数的参数. ...
- MSG 结构
MSG 消息结构 在 Windows 程序中,消息是由 MSG 结构体来表示的. 结构原型: typedef struct tagMSG { HWND hwnd; UINT message; ...