HDU4405 水概率
来源:互联网 发布:vb网络编程及应用 编辑:程序博客网 时间:2024/06/02 05:48
#include <stdio.h>#include <string.h>#include <algorithm>#include<iostream>#include <cstring>double dp[500000];int qw[500000];using namespace std;int main(){ int n, m; while (cin >> n >> m) { if (n == 0)break; memset(dp, 0, sizeof(dp)); memset(qw, 0, sizeof(qw)); int q, w; for (int a = 1;a <= m;a++) { scanf("%d%d", &q, &w); qw[q] = w; } for (int a = n - 1;a >= 0;a--) { if (qw[a])dp[a] = dp[qw[a]]; else { for (int b = 1;b <= 6;b++)dp[a] += dp[a + b] / 6.0; dp[a] += 1; } } printf("%.4lf\n", dp[0]); } return 0;}
0 0
- HDU4405 水概率
- hdu4405(概率DP)
- HDU4405概率DP入门
- hdu4405概率dp入门
- hdu4405 概率dp
- hdu4405概率DP
- hdu4405(概率dp)
- hdu4405(概率dp)
- hdu4405 概率期望
- hdu4405 概率dp
- hdu4405 概率dp
- HDU4405(概率DP求期望)
- hdu4405 Aeroplane chess (概率dp)
- HDU4405--Aeroplane chess--概率DP
- 【HDU4405】【Aeroplane chess】【概率dp】
- hdu4405(概率DP求期望)
- 简单概率DP——hdu4405
- hdu4405--Aeroplane chess+概率期望dp
- 服务器安装dedecms是提示GD及mysql不支持解决方案
- 括号配对问题
- 12.2 Spring整合myBatis
- valgrind详解
- 二叉树
- HDU4405 水概率
- 移动端绝对定位无法隐藏的问题解决方案
- 【转】FatFS文件系统介绍及使用例程
- 2016年年终总结
- CodeForce 439C Devu and Partitioning of the Array(模拟)
- C++ Qt Game Tutorial 2 - Moving With the Arrow Keys
- CCF 2015 9-2 日期计算
- 迅雷首席工程师:程序员成长之道 很有帮助的一篇文章
- jar包的使用