uva 11427 Expect the Expected 概率dp求期望
来源:互联网 发布:安卓post提交数据 编辑:程序博客网 时间:2024/05/22 02:07
题目链接
#include<cstdio>#include<cstring>#include<cmath>#include<algorithm>using namespace std;const int MAXN=100+50;int n,a,b;double p;double dp[MAXN][MAXN];int main(){ //freopen("text.txt","r",stdin); int T,kase=0; scanf("%d",&T); while(T--) { kase++; scanf("%d/%d%d",&a,&b,&n); p=a*1.0/b; memset(dp,0,sizeof(dp)); dp[0][0]=1.0; for(int i=1;i<=n;i++) for(int j=0;j*b<=a*i;j++) { if(j==0) dp[i][j]=dp[i-1][j]*(1-p); else dp[i][j]=dp[i-1][j]*(1-p)+dp[i-1][j-1]*p; } double Q=0.0; for(int i=0;i*b<=n*a;i++) Q+=dp[n][i]; printf("Case #%d: %d\n",kase,(int)(1/Q)); } return 0;}
0 0
- uva 11427 Expect the Expected 概率dp求期望
- Uva 11427 Expect the Expected 概率dp 求数学期望
- UVA 11427 - Expect the Expected (概率DP 期望)
- UVA 11427 Expect the Expected (概率dp+推公式求期望 详解)
- UVA 11427 - Expect the Expected(概率递推期望)
- UVA 11427 Expect the Expected 概率与期望
- UVA - 11427 Expect the Expected (DP+概率)
- UVA 11427 Expect the Expected【期望】
- uva 11427 - Expect the Expected(概率)
- 概率DP,记忆化搜索(Expect the Expected,uva 11427)
- Expect the Expected(dp+概率)
- UVA 11427 Expect the Expected
- UVA 11427 - Expect the Expected
- [UVA 11427] Expect the Expected
- UVA 11427 Expect the Expected
- Uva 11427 Expect the Expected
- UVa 11427 Expect the Expected
- 概率dp 求期望
- 黑马程序员_String类和StringBuffer类
- IOS保存图片到本地
- 硬件内存的情况--内存就是RAM?
- Linux 中VIM 的使用
- Android4.4 Telephone简介
- uva 11427 Expect the Expected 概率dp求期望
- 臭名昭著的和原型
- 脑子弹软件回顾是脑子弹真正有效的或不
- POJ 1751 Highways
- C#:代表(delegate)和事件(event)
- Alex 的 Hadoop 菜鸟教程: 第22课 分布式日志收集组件:flume
- 联合国占据指南易趣卖家
- Three.js中FirstPersonControls.js的用法
- 8.无法访问developer.android.com的解决方案。