1. 程式人生 > >【模擬試題】Scout YYF I

【模擬試題】Scout YYF I

Description

YYF is a couragous scout. Now he is on a dangerous mission which is to penetrate into the enemy's base. After overcoming a series difficulties, YYF is now at the start of enemy's famous "mine road". This is a very long road, on which there are numbers of mines. At first, YYF is at step one. For each step after that, YYF will walk one step with a probability of p, or jump two step with a probality of 1-p. Here is the task, given the place of each mine, please calculate the probality that YYF can go through the "mine road" safely. 
題意:
你在一條佈滿地雷的道路上,開始在座標1。每次有概率P向前走一步,有概率1-P向前走兩步。道中路某幾個點上會有地雷,問你安全通過的概率。地雷數N<=10,座標範圍在100000000內。