LightOJ 1317 Throwing Balls into the Baskets 概率/期望

Throwing Balls into the Baskets LightOJ - 1317

隔一定的距离把球扔到框里,nn 个人扔 mm 个框,在每一轮中每个人都选择一个框进行投篮(mm 个框每个被选中的概率都相同),每个人投中的概率都是 pp,求 kk 轮之后总共命中次数的期望值。

额,很简单: npknpk

#include<iostream>
#include<cstdio>
//#define WINE
using namespace std;
int T,iCase,n,m,k;
double p;
int main(){
#ifdef WINE
    freopen("data.in","r",stdin);
#endif
    scanf("%d",&T);
    while(T--){
        scanf("%d%d%d%lf",&n,&m,&k,&p);
        printf("Case %d: %.8lf\n",++iCase,n*p*k);
    }
    return 0;
}

在这里插入图片描述

posted @ 2020-03-26 11:07  winechord  阅读(91)  评论(0编辑  收藏  举报