Aeroplane chess hdu 4405
来源:互联网 发布:酷家乐装修设计软件 编辑:程序博客网 时间:2024/05/29 19:07
Aeroplane chess
Time Limit: 1000msMemory Limit: 32768KB This problem will be judged on HDU. Original ID: 4405
64-bit integer IO format: %I64d Java class name: Main
Prev Submit Status Statistics Next
Type:
None
Tag it!
Hzz loves aeroplane chess very much. The chess map contains N+1 grids labeled from 0 to N. Hzz starts at grid 0. For each step he throws a dice(a ice have six faces with equal probability to face up and the numbers on the faces are 1,2,3,4,5,6). When Hzz is at grid i and the dice number is x, he will moves to grid i+x. Hzz finishes the game when i+x is equal to or greater than N.
There are also M flight lines on the chess map. The i-th flight line can help Hzz fly from grid Xi to Yi (0
#include<stdio.h>#include<string.h>double dp[100010];int vis[100010];int main(){ int n, m; while (~scanf("%d %d",&n,&m)&&(n+m)) { memset(vis, -1, sizeof(vis)); int a, b; while (m--) { scanf("%d %d", &a, &b); vis[a] = b; } int i, j; memset(dp, 0, sizeof(dp)); for (i = n - 1; i >= 0; i--) { if (vis[i] == -1) { for (j = 1; j < 7; j++) { dp[i] += dp[i + j] / 6.0; } dp[i] += 1; } else dp[i] = dp[vis[i]]; } printf("%.4lf\n", dp[0]); } return 0;}
- hdu 4405 Aeroplane chess
- hdu 4405 Aeroplane chess
- HDU 4405 Aeroplane chess
- hdu 4405 Aeroplane chess
- hdu 4405 Aeroplane chess
- HDU 4405 Aeroplane chess
- hdu 4405 Aeroplane chess
- hdu 4405 Aeroplane chess
- HDU 4405 Aeroplane chess
- HDU 4405 Aeroplane chess
- HDU 4405Aeroplane chess
- HDU 4405 Aeroplane chess
- hdu 4405 Aeroplane chess
- hdu #4405:Aeroplane chess
- HDU 4405 Aeroplane chess
- HDU 4405 Aeroplane chess
- HDU 4405 Aeroplane chess
- hdu 4405 Aeroplane chess
- Vim键盘映射(Map)
- ubuntu14.04安装Tensorflow
- 将序列与zip结合起来
- Spark中的一些概念
- Android Studio 配置 FindBugs
- Aeroplane chess hdu 4405
- <Shader>phong 光照模型和 blinn phong 模式
- ReactNative项目 Python批量打包 (对美团第三种批量打包区分渠道的方法封装)
- Shell特殊变量:Shell $0, $#, $*, $@, $?, $$和命令行参数
- log4j+logback+slf4j+commons-loggin的关系
- Kotlin 踩坑日记(四) Maven Google 仓库 gradle 使用
- Git 基本操作
- 继孔子之后又一大儒朱熹后裔在松滋
- 中国第一台量子计算机诞生 中国军工尖端技术取得重大突破