hdu4405[Aeroplane chess] 有点懂了期望概率DP
来源:互联网 发布:淘宝碧素堂面膜怎么样 编辑:程序博客网 时间:2024/05/24 07:01
f ( i)表示走到i的期望
f ( i ) = f ( i+j ) * ( 1 / 6 )
f ( i ) = nxt [i]
#include <cstdio>#include <cstring>#include <iostream>#include <algorithm>using namespace std;const int N = 1e5 + 10 ;int nxt [N] ;double f [N] ;int main () { int n , m ; while ( scanf ( "%d%d" , & n , & m ) != EOF && ( n != 0 || m != 0 ) ) { memset ( f , 0 , sizeof f ) ; memset ( nxt , 0 , sizeof nxt ) ; for ( int i = 1 ; i <= m ; ++ i ) { int x , y ; scanf ( "%d%d" , & x , & y ) ; nxt [x] = y ; } for ( int i = n-1 ; i >= 0 ; -- i ){ if ( nxt [i] ) { f [i] = f [ nxt [i] ] ; continue ; } for ( int j = 6 ; j >= 1 ; -- j ) f [i] += ( f [i+j] ) * ( 1.0 / 6 ) ; f [i] += 1 ; } printf ( "%.4lf\n" , f [0] ) ; } return 0 ;}
阅读全文
0 0
- hdu4405[Aeroplane chess] 有点懂了期望概率DP
- hdu4405--Aeroplane chess+概率期望dp
- HDU4405 Aeroplane chess (概率DP求期望)
- hdu4405 Aeroplane chess【概率DP+期望问题】
- HDU4405:Aeroplane chess(概率dp & 期望)
- hdu4405 Aeroplane chess 【期望dp】
- 【期望DP】HDU4405 Aeroplane chess
- hdu4405 Aeroplane chess (概率dp)
- HDU4405--Aeroplane chess--概率DP
- 【HDU4405】【Aeroplane chess】【概率dp】
- HDU4405-Aeroplane chess(概率DP求期望)
- hdu4405 Aeroplane chess(期望dp)
- hdu4405 Aeroplane chess 期望
- [hdu 4405] Aeroplane chess [概率DP & 期望]
- hdu4405 Aeroplane chess---金华网络赛 期望
- HDU 4405 Aeroplane chess 概率dp求期望
- 简单概率dp(期望)-hdu-4405-Aeroplane chess
- HDU 4405 Aeroplane chess (概率DP求期望)
- Android跨进程通信中,对Binder的不完全理解
- windows之UIAutomation鼠标操作
- web uploader在Firefox下上传点击无效的解决方法
- 如何设置输入框input中placeholder的字体颜色、字号
- Java集合框架之_泛型
- hdu4405[Aeroplane chess] 有点懂了期望概率DP
- Log4j 重写 RollingFileAppender 实现按日期生成文件夹文件名
- 编写MANIFEST.MF文件时的注意事项:
- mkv210_image.c文件
- 条件随机场CRF
- 学习IT编程必看的资源介绍
- Android设计模式之——迭代器模式
- bzoj2201彩色圆环 期望DP
- 与数字化工具结合使用的笔记法