Discovering Gold

这是一个关于在1xN格子洞穴中寻找黄金的问题。玩家从第一格开始,每次掷骰子前进,收集经过格子的黄金。若到达洞穴尽头则停止。给定洞穴中每格的黄金数量,需要计算按照规则进行的预期黄金总收集量。题目提供输入输出示例,并说明了计算每个位置期望值的递推公式:f(i)=1/6*Σf(j), j∈[i+1,i+6],对于接近洞穴起点的特殊情况需特殊处理。" 138200208,7764491,安卓APP媒体开发:常见问题与解决方案,"['android', '手机开发', 'APP开发', '媒体播放开发', '音视频']
摘要由CSDN通过智能技术生成

You are in a cave, a long cave! The cave can be represented by a 1 x N grid. Each cell of the cave can contain any amount of gold.

Initially you are in position 1. Now each turn you throw a perfect 6 sided dice. If you get X in the dice after throwing, you add X to your position and collect all the gold from the new position. If your new position is outside the cave, then you keep throwing again until you get a suitable result. When you reach the Nth position you stop your journey. Now you are given the information about the cave, you have to find out the expected number of gold you can collect using the given procedure.

Input

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值