ZOJ-3696 Alien's Organ(泊松分布)
来源:互联网 发布:免费刷超级会员软件 编辑:程序博客网 时间:2024/05/01 18:15
There's an alien whose name is Marjar. It is an universal solder came from planet Highrich a long time ago.
Marjar is a strange alien. It needs to generate new organs(body parts) to fight. The generated organs will provide power to Marjar and then it will disappear. To fight for problem of moral integrity decay on our earth, it will randomly generate new fighting organs all the time, no matter day or night, no matter rain or shine. Averagely, it will generate λ new fighting organs every day.
Marjar's fighting story is well known to people on earth. So can you help to calculate the possibility of that Marjar generates no more than N organs in one day?
Input
The first line contains a single integer T (0 ≤ T ≤ 10000), indicating there are T cases in total. Then the following T lines each contains one integer N (1 ≤ N ≤ 100) and one float number λ(1 ≤ λ ≤ 100), which are described in problem statement.Output
For each case, output the possibility described in problem statement, rounded to 3 decimal points.Sample Input
35 8.0008 5.0002 4.910
Sample Output
0.1910.9320.132
泊松分布的概率函数为:
泊松分布的参数λ是单位时间(或单位面积)内随机事件的平均发生率。 泊松分布适合于描述单位时间内随机事件发生的次数。
#include <iostream>#include <cmath>#include <stdio.h>using namespace std;double rate;void work(int k,double l){double step;rate=0;while(k){step=1;step/=exp(l);for(int i=1;i<=k;i++){step=step*l/(i*1.0);}k--;rate+=step;}rate+=1/exp(l);}int main(){int t,k;double l;cin>>t;while(t--){cin>>k>>l;work(k,l);printf("%.3f\n",rate);}return 0;}0 0
- zoj 3696 Alien's Organ(泊松分布)
- ZOJ-3696 Alien's Organ(泊松分布)
- ZOJ 3696 Alien's Organ / 泊松分布
- ZOJ 3696 Alien's Organ(泊松分布)
- ZOJ 3696 Alien's Organ 泊松分布
- ZOJ3696-Alien's Organ(泊松分布)
- zoj 3696 Alien's Organ
- ZOJ 3696 Alien's Organ
- zoj 3696 Alien's Organ
- <模板>zoj3696 Alien's Organ 概率论:泊松分布
- ZOJ 3696 Alien's Organ
- zoj3696Alien's Organ (二项分布,泊松分布求近似值)
- A - Alien's Organ
- ZOJ3696 Alien's Organ
- ZOJ 1085 Alien Security(SPFA+dfs)
- ZOJ-1085 Alien Security
- hdu 1689 Alien’s Necklace (bfs层次图剪枝)
- hdu 1689 Alien’s Necklace
- 杭电ACM2001:两点间距离
- 取余和取模
- HTML mata标签详解
- (已解)不初始化APP,进行运行
- MySQL5.7安装过程和一些坑
- ZOJ-3696 Alien's Organ(泊松分布)
- 代码整洁之道精华——第二章 有意义的命名
- SpringMVC+myBatis启动报错:Access denied for user 'stati'@'localhost' (using password: YES)
- code review的做法以及问题
- 汪海Python爬虫(一)抓取网页的含义和URL基本构成
- Spring <context:annotation-config/> 解说
- 思科模拟器:通过ip route命令将三台路由器相接的两台电脑连通
- var 作用域||变量
- 《JavaScript高级程序设计 第三版》学习笔记 (十一)事件详解