BZOJ 1419 Red is good
来源:互联网 发布:php环境配置教程win10 编辑:程序博客网 时间:2024/04/30 13:49
期望DP
f[i][j]表示i张红牌,j张黑牌
从 f[i-1][j],f[i][j-1],0 转移过来,注意下界为0要判,因为取成负数肯定不优
#include<cstdio>#include<cstring>#include<algorithm>#define N 5005using namespace std;double f[2][N];int main(){ int n, m, cur=0; scanf("%d%d",&n,&m); for(int i = 1; i <= n; i++,cur^=1) { f[cur][0]=i; for(int j = 1; j <= m; j++) f[cur][j]=max(0.0 , 1.0*i/(i+j)*(f[cur^1][j]+1) + 1.0*j/(i+j)*(f[cur][j-1]-1)); } printf("%lf\n",f[cur^1][m]-0.0000005);}
0 0
- bzoj 1419: Red is good
- BZOJ 1419 Red is good
- BZOJ 1419: red is good
- 【BZOJ】1419 Red is Good
- BZOJ 1419 Red is good 期望DP
- BZOJ 1419: Red is good|期望Dp
- bzoj 1419: Red is good 期望dp
- 【BZOJ 1419】Red is good 期望dp
- BZOJ 1419: Red is good 期望DP
- BZOJ 1419: Red is good 期望DP
- bzoj 1419 Red is good 【期望dp】
- bzoj 1419: Red is good (概率与期望)
- bzoj 1419 Red is good 概率dp求期望
- bzoj 1419 Red is good(概率与期望)
- 【bzoj 1419】Red is good(期望DP)
- 【BZOJ】【P1419】【Red is good】【题解】【DP】
- Red is good (DP)
- [HbFS-]Red is good
- Ubuntu编译运行cocos2d-x项目,导入Clion
- 这些安全类书籍值得一读
- Spring+C3P0数据库连接池配置
- CV Datasets on the web
- tomcat 乱码问题
- BZOJ 1419 Red is good
- 高性能网络编程(二):上一个10年,著名的C10K并发连接问题
- 喷水装置(一)
- mysql连接eclipse。
- win7下xshell连接不上虚拟机centos问题
- leetcode难度及面试频率
- Vim 多窗口操作
- listview复用checkbox显示错乱解决demo
- Java中的对象拷贝