ZOJ 3696 Alien's Organ
泊松分布。。。。
Alien's Organ
Time Limit: 2 Seconds Memory Limit: 65536 KB
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
- 3
- 5 8.000
- 8 5.000
- 2 4.910
Sample Output
- 0.191
- 0.932
- 0.132
Author: FAN, Yuzhe
Contest: The 13th Zhejiang University Programming Contest
- #include <iostream>
- #include <cstdio>
- #include <cstring>
- #include <cmath>
- using namespace std;
- double boshon(int x,double r)
- {
- double ans=exp(-r)*pow(r,x);
- for(int i=;i<=x;i++)
- {
- ans=ans/i;
- }
- return ans;
- }
- int main()
- {
- int t;
- scanf("%d",&t);
- while(t--)
- {
- int x;
- double y;
- cin>>x>>y;
- double ans=.;
- for(int i=;i<=x;i++)
- {
- ans+=boshon(i,y);
- }
- 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 is Marja ...
- ZOJ 3696 Alien's Organ 概率论 泊松分布
看了好久的题,但还是看得一脸蒙圈,感觉完全无从下手,我的队友告诉我可能是正太分布之类的,但我感觉不太像,后来才听同学说是泊松分布,才恍然大悟,概率论刚刚学过这里不久,不禁感叹,学会了还要会用啊... ...
- 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 ...
- ZOJ 1825 compoud words
题目大意:输入一串递增的单词序列,需要找出符合条件的单词递增输出,条件是:将一个单词拆成左右两个单词后,能在输入中找到这两个单词.例如单词 alien,可以拆成 a 和 lien,而输入中刚好同时有a ...
- ZOJ People Counting
第十三届浙江省大学生程序设计竞赛 I 题, 一道模拟题. ZOJ 3944http://www.icpc.moe/onlinejudge/showProblem.do?problemCode=394 ...
- [LeetCode] Alien Dictionary 另类字典
There is a new alien language which uses the latin alphabet. However, the order among letters are un ...
随机推荐
- 关于css的一些事情(1)
什么情况下hidden不起作用? position设置成fixed,overflow的hidden不起作用. visibility和display 1.visibility: 规定了元素是否可见,即使 ...
- 【原】HTML5 新增的结构元素——能用并不代表对了
做移动端有一段时间,今天有同事问了我 article 和 section 标签的使用,模模糊糊的解释了下,他似懂非懂,有点小尴尬.忽然间觉得自己有必要再翻翻书籍,重温下 html5 的新元素.html ...
- 项目<<魔兽登录系统>>
创建魔兽系统相关窗体: 登录窗体(frmLogin) 注册窗体(frmRegister) 主窗体 (frmMain) 实现魔兽登录系统: 登录的界面如下 实现思路: 1.创建一个对象数组,长度为1 ...
- AC日记——I Hate It 洛谷 P1531
题目背景 很多学校流行一种比较的习惯.老师们很喜欢询问,从某某到某某当中,分数最高的是多少.这让很多学生很反感. 题目描述 不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的 ...
- Es6 箭头函数
1.单参数function cheng(a=3){ return a*a;}let cheng= (a=3)=>a*a;console.log(cheng(9));2.多参数functio ...
- TFS 掩蔽或取消掩蔽工作区中的文件夹
掩蔽或取消掩蔽工作区中的文件夹 使用掩蔽功能可以阻止用户查看指定的工作区文件夹或者您当前不需要的文件夹.当您在对一个公共父级下的两个或更多个分支中的文件进行操作时,就可以使用掩蔽功能来避免复制不必要的 ...
- Query节点操作,jQuery插入节点,jQuery删除节点,jQuery Dom操作
一.创建节点 var box = $('<div>节点</div>'); //创建一个节点,或者var box = "<div>节点</div> ...
- while跟do...while的用法
while语句的形式: while(逻辑表达式){语句:.......} 执行过程: 先判断逻辑表达式的值.若=true,则执行其后面的语句,然后在次判断条件并反复执行, 直到条件不成立为止. do ...
- 在intellj idea下用sbt的坑
version : SBT 0.13.7 intellij 14 新建SBT项目以后无法编译,总是显示 Can not resolve symble stackoverflow 给出了暂时的解决办法. ...
- 【USACO 2.4】The Tamworth Two
题意:C代表cows,F代表farmer,一开始都向北,每分钟前进1步,如果前方不能走,则这分钟顺时针转90°,问多少步能相遇,或者是否不可能相遇,10*10的地图. 题解:dfs,记录状态,C和F的 ...