链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=35396

【思路】

  DP+概率

  见白书。

【代码】

 #include<cstdio>
#include<cstring>
using namespace std; const int N = +; int n,a,b;
double f[N][N]; int main() {
int T,kase=;
scanf("%d",&T);
while(T--) {
scanf("%d/%d%d",&a,&b,&n);
double p=(double)a/b;
memset(f,,sizeof(f));
f[][]=;
for(int i=;i<=n;i++)
for(int j=;j*b<=a*i;j++) {
f[i][j]=f[i-][j]*(-p);
if(j) f[i][j] += f[i-][j-]*p;
}
double Q=;
for(int j=;j*b<=a*n;j++) Q += f[n][j];
printf("Case #%d: %d\n",++kase,(int)(/Q));
}
return ;
}

UVA 11427 Expect the Expected(DP+概率)的更多相关文章

  1. UVA 11427 - Expect the Expected(概率递归预期)

    UVA 11427 - Expect the Expected 题目链接 题意:玩一个游戏.赢的概率p,一个晚上能玩n盘,假设n盘都没赢到总赢的盘数比例大于等于p.以后都不再玩了,假设有到p就结束 思 ...

  2. uva 11427 - Expect the Expected(概率)

    题目链接:uva 11427 - Expect the Expected 题目大意:你每天晚上都会玩纸牌,每天固定最多玩n盘,每盘胜利的概率为p,你是一个固执的人,每天一定要保证胜局的比例大于p才会结 ...

  3. UVA - 11427 Expect the Expected (概率dp)

    Some mathematical background. This problem asks you to compute the expected value of a random variab ...

  4. UVa 11427 Expect the Expected (数学期望 + 概率DP)

    题意:某个人每天晚上都玩游戏,如果第一次就䊨了就高兴的去睡觉了,否则就继续直到赢的局数的比例严格大于 p,并且他每局获胜的概率也是 p,但是你最玩 n 局,但是如果比例一直超不过 p 的话,你将不高兴 ...

  5. UVa 11427 - Expect the Expected

    http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&p ...

  6. UVA 11427 Expect the Expected (期望)

    题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=26&pa ...

  7. UVA.11427.Expect the Expected(期望)

    题目链接 \(Description\) https://blog.csdn.net/Yukizzz/article/details/52084528 \(Solution\) 首先每一天之间是独立的 ...

  8. 11427 - Expect the Expected(概率期望)

    11427 - Expect the Expected Some mathematical background. This problem asks you to compute the expec ...

  9. UVA 11427 (概率DP+期望)

    题目链接: http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=35396 题目大意:每晚打游戏.每晚中,赢一局概率p,最多玩n局, ...

随机推荐

  1. [IO] C# FileOperateHelper文件操作类与源码下载

    主要功能如下所示 源码预览 /// <summary> /// 类说明:Assistant /// 编 码 人:苏飞 /// 联系方式:361983679 /// 更新网站:[url]ht ...

  2. 《你不常用的c#之四》:Array的小抽屉ArraySegment

    转载自csdn:http://blog.csdn.net/robingaoxb/article/details/6200060 一:)略谈      ArraySegment顾名思义就是Array区块 ...

  3. Sql Server 2008 还原数据库 3154错误

    sqlserver2008还原数据库时出现了3154错误,具体错误信息如下: 错误信息 The backup set holds a backup of a database other than t ...

  4. HTML基础(2) 格式标签 文本标签

    格式标签: 1.<p></p>  用来显示段落 2.<br> 控制换行 3.<nobr> </nobr> 防止浏览器将过长内容自动换行显示 ...

  5. Windows下的进程【一】

    什么是进程?进程就是一个正在运行的程序的实例,由两部分组成: 内核对象.操作系统用内核对象对进程进行管理,内核对象是操作系统保存进程统计信息的地方. 地址空间.其中包含所有可执行文件或DLL模块的代码 ...

  6. [LeetCode OJ] Roman to Integer

    Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 t ...

  7. php日期处理

    $datetime=strtotime(date("Y-m-d",time()));//获取当前日期并转换成时间戳 $datetime=$datetime+86400;//在时间戳 ...

  8. sharepoint读取站点下列表

    前言 还是自己做着练习,也算对这个代码的一个认识吧.东西没什么. 过程 这是后台的一下代码,其中我会对标注的地方解释一下. 标注1:是获取的列表中的某一个列名,标注2:是这个列表下的数据列的名称,我们 ...

  9. jquery返回顶部-ie6配合css表达式。

    css: .wraper{ width:980px; height:2048px; margin:0 auto; background:#ccc; } /*返回头部*/ #backToTop a{;; ...

  10. html5 中的 css样式单 的 两种调用方式的区别

    在 html5 中 使用 css 样式单的方式 有4种: 1.链接外部样式文件:将样式文件 彻底与 html 文档分离,样式文件需要额外引入,这种情况下 一批样式 可以控制多份文档.对于好多文件都共有 ...