日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

zoj 3696 Alien's Organ(泊松分布)

發(fā)布時間:2025/3/16 编程问答 18 豆豆
生活随笔 收集整理的這篇文章主要介紹了 zoj 3696 Alien's Organ(泊松分布) 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

題目鏈接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3696

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
題意:一個外星人隨機(jī)產(chǎn)生器官,一天產(chǎn)生的數(shù)量的期望是x,求一天內(nèi)產(chǎn)生個數(shù)小于等于N的概率。 分析:泊松分布的概率分布函數(shù)為: 泊松分布的參數(shù)λ是單位時間(或單位面積)內(nèi)隨機(jī)事件的平均發(fā)生率。 泊松分布適合于描述單位時間內(nèi)隨機(jī)事件發(fā)生的次數(shù)。 ?泊松分布的期望和方差均為λ。
#include <cstdio> #include <cmath>int main() {double x;int T, n;scanf("%d", &T);while(T--) {scanf("%d%lf", &n, &x);double ans = 0;double fac = 1;for(int i = 1; i <= n; i++) {fac *= (double)i;ans += pow(x, (double)i) / fac * exp(-x);}ans += exp(-x); // P(x=0)的情況printf("%.3lf\n", ans);}return 0; }


總結(jié)

以上是生活随笔為你收集整理的zoj 3696 Alien's Organ(泊松分布)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。