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 ...
随机推荐
- 使用Office 365抓取PM2.5数据
近日微软发布了Microsoft Flow,一个类似IFTTT自动化任务触发工具.例如,我们可以设置这样一个触发事件和对应的处理过程:当有人在微博上@我的时候,发一封邮件通知我:当我关注的博主有新文章 ...
- UI自动化,你值得拥有
去年春节联欢晚会,为了那张“敬业福”,全家都卯足了劲儿“咻一咻”,连节目都顾不上看了.当时我就想,要是能自动化该多好,不停点击屏幕,屏幕不疼手还疼呢,何况还不好分心,生怕错过了“敬业福”.玩“咻一咻” ...
- 嵌入式Linux驱动学习之路(二十)USB设备驱动
USB在接入系统的时候,以0的设备ID和主机通信,然后由主机为其分配新的ID. 在主机端,D+和D-都是下拉接地的.而设备端的D-接上拉时,表明此设备为高速设备:12M/s. D+接上拉时则是全速设备 ...
- Spring.net使用说明
使用方法: 1.在配置文件设置Spring.net 节点 在配置节中,声明Spring.net,配置 context,objects 标签,来源(type) <!--配置节:主要用来 配置 a ...
- kendo ui简介
Kendo UI Web包含所有创建高速HTML5 web app的必备元素:UI组件.数据源.验证.一个MVVM框架.主题.模板等等. 移动HTML5带UI的开发框架层出不穷,常见的有Sencha ...
- LeetCode Intersection of Two Arrays
原题链接在这里:https://leetcode.com/problems/intersection-of-two-arrays/ 题目: Given two arrays, write a func ...
- 几种display:table-cell的应用
一.display:table-cell属性简述 display:table- cell属性指让标签元素以表格单元格的形式呈现,类似于td标签.目前IE8+以及其他现代浏览器都是支持此属性的,但是IE ...
- 《深入理解计算机系统V2》学习指导
<深入理解计算机系统V2>学习指导 目录 图书简况 学习指导 第一章 计算机系统漫游 第二章 信息的表示和处理 第三章 程序的机器级表示 第四章 处理器体系结构 第五章 优化程序性能 第六 ...
- 【原】浅谈KL散度(相对熵)在用户画像中的应用
最近做用户画像,用到了KL散度,发现效果还是不错的,现跟大家分享一下,为了文章的易读性,不具体讲公式的计算,主要讲应用,不过公式也不复杂,具体可以看链接. 首先先介绍一下KL散度是啥.KL散度全称Ku ...
- C/C++实践笔记 007
进制输出自己写一个_itoa 进制转换void main(){ int num = 0; scanf("%d", &num); printf("num=%i&qu ...