codeforces 453A Little Pony and Expected Maximum(期望)
来源:互联网 发布:淘宝店铺怎么开微淘 编辑:程序博客网 时间:2024/05/22 12:21
要求抛掷n次中出现的最大的数字的数学期望,先算出每个数字成为最大的数字的概率,容易推得数字x出现的概率为 (x/m)^n - ((x-1)/m)^n,然后和数字相乘再加起来就是结果了。
#include<cstdio>#include<cmath>int m,n;double probability(int x){ return pow(x/(double)m,n)-pow((x-1)/(double)m,n);}int main(){ scanf("%d%d",&m,&n); int i; double ans=0; for(i=1;i<=m;i++) ans+=probability(i)*i; printf("%.12lf\n",ans); return 0;}
0 0
- codeforces 453A Little Pony and Expected Maximum(期望)
- Codeforces 453A Little Pony and Expected Maximum(期望)
- codeforces 453A Little Pony and Expected Maximum 最大值期望
- Codeforces 453A Little Pony and Expected Maximum 概率期望
- codeforces 453A. Little Pony and Expected Maximum (概率与期望+快速幂)
- 【CF 453A】 Little Pony and Expected Maximum (最大期望)
- Codeforces 453A Little Pony and Expected Maximum
- Codeforces 453A. Little Pony and Expected Maximum
- Codeforces 453 A. Little Pony and Expected Maximum
- codeforces 453-A Little Pony and Expected Maximum
- 【codeforces】 453A Little Pony and Expected Maximum
- Codeforces 453A Little Pony and Expected Maximum
- Codeforces 453A Little Pony and Expected Maximum
- CodeForces 453A Little Pony and Expected Maximum
- [概率DP] Codeforces 453A Little Pony and Expected Maximum
- Codeforces 453 A. Little Pony and Expected Maximum
- Codeforces 454C Little Pony and Expected Maximum 简单期望
- CodeForces 453 A.Little Pony and Expected Maximum(快速幂)
- 【Leet Code】ZigZag Conversion
- MBR&GPT
- ZOJ 3804 YY's Minions
- Red Hat Linux 下卸载旧mysql,安装新版本.
- 坑人的浮点数——小数点后的位数。
- codeforces 453A Little Pony and Expected Maximum(期望)
- 回归测试,白盒测试,黑盒测试
- POJ 1151 Atlantis
- 【Java集合源码剖析】Java集合框架
- 多线程例子双线性例子
- log4net配置
- The connection to adb is down, and a severe error has occured.
- CBCGPChartCtrl
- mfc 在同一个工程中使用多个资源文件