ZOJ 3329 One Person Game(概率dp 经典)
来源:互联网 发布:饥饿游戏知乎 编辑:程序博客网 时间:2024/06/07 01:16
题目链接:https://vjudge.net/problem/ZOJ-3329
#include<cstdio>#include<cstring>#include<string>#include<cctype>#include<iostream>#include<set>#include<map>#include<cmath>#include<sstream>#include<vector>#include<stack>#include<queue>#include<algorithm>#define fin freopen("a.txt","r",stdin)#define fout freopen("a.txt","w",stdout)typedef long long LL;using namespace std;typedef pair<int, int> P;const int INF = 1e8 + 10;const int maxn = 1000 + 10;double A[maxn], B[maxn], p[maxn], p0;int n, k1, k2, k3, a, b, c;int main(){//fin;int T;scanf("%d", &T);while(T--){cin >> n >> k1 >> k2 >> k3 >> a >> b >> c; p0 = 1.0/(k1*k2*k3); memset(p, 0, sizeof p); memset(A, 0, sizeof A); memset(B, 0, sizeof B); for(int i = 1; i <= k1; i++) for(int j = 1; j <= k2; j++) for(int k = 1; k <= k3; k++) if(i != a || j != b || k != c) p[i+j+k] += p0; for(int i = n; i >= 0; i--) { A[i] = p0; B[i] = 1.0; for(int k = 3; k + i <= n; k++) { A[i] += p[k]*A[i+k]; B[i] += p[k]*B[i+k]; } } printf("%.12f\n", B[0]/(1.0-A[0]));}return 0;}
阅读全文
0 0
- ZOJ 3329 One Person Game(概率dp 经典)
- ZOJ 3329 One Person Game(概率dp)
- ZOJ 3329 One Person Game 概率DP
- zoj 3329 One Person Game(概率DP)
- zoj 3329 One Person Game(概率dp)
- ZOJ 3329 One Person Game (概率dp)
- zoj 3329 One Person Game 概率dp
- zoj 3329 One Person Game (概率DP )
- ZOJ 3329 One Person Game (概率DP)
- ZOJ - 3329 One Person Game(概率dp)
- ZOJ 3329 One Person Game 概率DP
- ZOJ 3329 One Person Game (概率DP)
- ZOJ 3329 One Person Game(概率DP)
- zoj 3329 One Person Game 概率dp
- ZOJ 3329 One Person Game 概率dp
- zoj 3329 One Person Game 概率dp
- ZOJ 3329 One Person Game (概率DP)
- ZOJ 3329 One Person Game [概率DP]
- C++各类设计模式及实现详解
- Linux:linux(centos)之安装tomcat并且部署java web项目
- hdu 6134 Battlestation Operational (莫比乌斯反演+线性筛法+差分)
- 20170818 有赞 电话面试总结
- udp中的connect()&bind()
- ZOJ 3329 One Person Game(概率dp 经典)
- Bear in the Field CodeForces
- 互联网保险创新之二--需求与渠道创新
- nefu84 五指山(扩展欧几里得)
- list的两种循环
- LeetCode-118-Pascal's Triangle(帕斯卡的三角形)
- 实现LVS-NAT
- Linux Hook技术实践
- 快速排序详解