POJ 2096 (概率dp)
来源:互联网 发布:可乐谢安琪歌词知乎 编辑:程序博客网 时间:2024/06/05 15:28
#pragma warning(disable:4996)#include<cstdio>#include<cstring>#include<string>#include<cmath>#include<vector>#include<algorithm>#include<iostream>using namespace std;const int INF = 0x3f3f3f3f;const int MAXN = 1010;double dp[MAXN][MAXN];int main(){ int n, s; while (scanf("%d%d", &n, &s) != EOF) { memset(dp, 0, sizeof(dp)); dp[n][s] = 0; double p1, p2, p3, p4; for (int i = n; i >= 0; i--) { for (int j = s; j >= 0; j--) { if (i == n&&j == s) continue; p1 =(double)(n - i)*j / n/s; p2 = (double)i*(s - j) / n / s; p3 = (double)(n - i)*(s - j) / n / s; p4 = (double)i*j / n / s; dp[i][j] = (p1*dp[i + 1][j] + p2*dp[i][j + 1] + p3*dp[i + 1][j + 1] + 1)/ (1 - p4); } } printf("%.4f\n", dp[0][0]); } return 0;}
1 0
- POJ 2096(概率DP)
- POJ 2096 (概率dp)
- poj 2096 概率dp
- poj 2096 概率dp
- POJ 2096 概率dp
- poj 2096<概率dp>
- poj 2096 概率dp
- POJ 2096 概率dp
- poj 2096 概率dp
- POJ 2096 概率DP
- poj 2096 概率dp
- POJ 2096 概率dp
- poj 2096概率dp
- poj 2096 Collecting Bugs (概率dp)
- POJ 2096 Collecting Bugs(概率DP)
- POJ 2096 Collecting Bugs(概率dp)
- POJ 2096 Collecting Bugs(概率DP)
- POJ 2096 Collecting Bugs(概率DP)
- 微软正式放弃安卓应用移植项目Project Astoria
- iOS label缩进
- spring拿到WebApplicationContext,获取bean
- ViewPagerIndicator _鸿洋
- R语言使用备忘
- POJ 2096 (概率dp)
- SVN搭建及简单使用
- Struts2学习-02
- HBase使用java编程建表报错zookeeper.ZooKeeper: org.apache.hadoop.hbase.TableExistsException: Case
- System.setProperty()
- json初学者介绍
- 构造函数而后拷贝构造函数的区别
- 解题:不用循环、递归,如何从 1 打印到 100(转)
- 一款用Java开发的MySQL,Oracle,PostgreSQL 数据库web管理维护软件