链接: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. Winform获取应用程序的当前路径

    //获取当前进程的完整路径,包含文件名(进程名). string str = this.GetType().Assembly.Location; result: X:\xxx\xxx\xxx.exe ...

  2. Tomcat启动后加载两次web.xml的问题(因为spring定时任务执行了俩次,引出此问题)

    http://www.linuxidc.com/Linux/2011-07/38779.htmhttp://jingyan.baidu.com/article/48206aeaf9422e216ad6 ...

  3. ios7--系统自带的向右滑动手势返回上一个界面

    当从控制器A push到控制器B,我们返回控制器A,除了使用按钮返回 [self.navigationController pushViewController:Vc animated:YES]; 还 ...

  4. Microsoft Visual Studio 2010 遇到了异常,可能是由某个扩展导致的。 转载

    问题: 今天打开好久没用的Microsoft Visual Studio 2010 ,刚才创建了一个C++工程,错误就出现了. 只要在VS2010源码编辑器中输入一个字符,它就报错 ":Mi ...

  5. upgrade和update的区别

    以前一直没搞清这二个词的意思,特别是linux软件管理的时候,用update和upgrade一直没弄明白,后来终于查清: upgrade一般是指比较重要的升级,或者说是主要的,单独版本的升级,其中软件 ...

  6. [Neural Networks] Dropout阅读笔记

    多伦多大学Hinton组 http://www.cs.toronto.edu/~rsalakhu/papers/srivastava14a.pdf 一.目的 降低overfitting的风险 二.原理 ...

  7. 更改input【type=file】样式

    <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content ...

  8. Maven介绍,包括作用、核心概念、用法、常用命令、扩展及配置

    由浅入深,主要介绍maven的用途.核心概念(Pom.Repositories.Artifact.Build Lifecycle.Goal).用法(Archetype意义及创建各种项目).maven常 ...

  9. 2016022605 - redis订阅发布

    Redis的实现消息队列功能,消息发布者发送的消息,消息接收者接收发布者的消息.由该消息传送的链路被称为通道.在Redis客户端可以订阅任何数目的通道. 案例:给出一个客户端订阅一个通道名为redis ...

  10. 零基础学redis

    第一个阶段:redis基本知识了解: 1. redis的百度百科解释: Redis是一个开源的使用ANSI C语言编写.支持网络.可基于内存亦可持久化的日志型.Key-Value数据库,并提供多种语言 ...