HDU 4405(概率dp)
来源:互联网 发布:企业网站界面优化 编辑:程序博客网 时间:2024/06/05 04:45
#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 = 100010;double dp[MAXN];int Hash[MAXN];int main(){ int N, M; while (cin >> N >> M,N||M) { memset(dp, 0, sizeof(dp)); memset(Hash, -1, sizeof(Hash)); dp[N] = 0; for (int i = M; i >= 1; i--) { int a, b; cin >> a >> b; Hash[a] = b; } for (int i = N - 1; i >= 0; i--) { if (Hash[i] == -1) { for (int k = 1; k <= 6; k++) { dp[i] += dp[i+k] * (1.0 / 6.0); } dp[i] += 1; } else { dp[i] = dp[Hash[i]]; } } printf("%.4f\n", dp[0]); } return 0;}
0 0
- HDU 4405(概率dp)
- hdu 4405 概率DP
- hdu 4405 概率dp
- 概率dp HDU 4405
- hdu 4405 概率dp
- HDU 4405(概率DP)
- HDU 4405 概率dp
- hdu 4405 概率dp
- hdu 4405 Aeroplane chess(概率dp)
- HDU 4405 Aeroplane chess (概率dp)
- hdu 4405 Aeroplane chess (概率dp)
- hdu 4405 Aeroplane chess(概率dp)
- hdu 4405 Aeroplane chess (概率DP)
- hdu 4405(概率dp简单题)
- HDU 4405 Aeroplane chess(概率DP)
- HDU 4405 Aeroplane chess (概率dp)
- HDU 4405 Aeroplane chess (概率DP)
- hdu 4405 Aeroplane chess(概率dp)
- 1046. Shortest Distance (20) PAT 甲级
- 64位mysql的安装---mysql-5.7.14-winx64
- Appcan学习——父页面调用子页面的方法
- android中用到的MimeType的处理方式
- Linux信号:linux下20种信号实例说明
- HDU 4405(概率dp)
- 在Application中获取屏幕宽度和高度
- POJ 2277 Count Color(线段树)
- 蓝牙模块在HHARM2410上的移植
- 【SQL】中获取特定表的所有列名
- JDT Icons (eclipse和mycelipse提示图标)大全
- Android安全机制探讨
- 落单的数 III
- 单例模式