yyf

Scout YYF I_poj3744

拥有回忆 提交于 2020-03-03 22:10:37
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. Input The input contains many test cases ended

Scout YYF I_poj3744

房东的猫 提交于 2020-03-03 22:10:10
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. Input The input contains many test cases ended

【POJ3744】Scout YYF I

末鹿安然 提交于 2019-11-27 15:27:16
Description YYF是一个英勇的侦查员。现在他正在执行打入到敌方内部的危险任务。在解决了一系列的险情后,YYF到达了敌方著名的"地雷路"起始点。这条路非常长,上面被精心排布了不少地雷。一开始,YYF站在1的位置。对于后面的路程,YYF有p的概率向前走一步,或者有1−p的概率向前跳两步。现在问题来了。非常喜欢坑队友的情报部得到了每个地雷的位置,但他们不准备告诉YYF,反而请你计算YYF能安全走过整条“地雷路”的概率。 Input 输入有多组数据,并由EOF结束. 每组数据由两行组成。 第一行是地雷的数量N and p 被一个空格分割。 第二行有n个数字,指代每个地雷的位置。 Output 对于每组数据,输出一行,为安全走过的概率,并保留7位小数。 Sample Input 1 0.5 2 2 0.5 2 4 Sample Output 0.5000000 0.2500000 HINT 1≤N≤10 0.25≤p≤0.75 地雷的位置∈[1,100000000] DP: \(dp[i]\) 表示安全走过点i的概率 \(dp[i]=dp[i-1]\) 来源: https://www.cnblogs.com/2017gdgzoi44/p/11368346.html