当前位置:网站首页>poj3744 Scout YYF I
poj3744 Scout YYF I
2022-08-08 13:21:00 【51CTO】
http://www.elijahqi.win/archives/3628
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 with EOF.
Each test case contains two lines.
The First line of each test case is N (1 ≤ N ≤ 10) and p (0.25 ≤ p ≤ 0.75) seperated by a single blank, standing for the number of mines and the probability to walk one step.
The Second line of each test case is N integer standing for the place of N mines. Each integer is in the range of [1, 100000000].
Output
For each test case, output the probabilty in a single line with the precision to 7 digits after the decimal point.
Sample Input
1 0.5
2
2 0.5
2 4
Sample Output
0.5000000
0.2500000
Source
POJ Monthly Contest - 2009.08.23, Simon
注意tle可能因为在快速幂的时候出现连续两个雷在一起的情况 特判之即可
剩下就是普通dp+矩阵快速幂而已..
边栏推荐
- 【第2天】SQL快速入门-条件查询(SQL 小虚竹)
- KD-SCFNet:通过知识蒸馏实现更准确、更高效的显着目标检测(ECCV2022)
- Flink1.15 组件RPC通信过程概览图
- PHP中使用XML-RPC构造Web Service简单入门
- 八月粉丝福利来了!大疆手机云台你爱了吗?
- 《预训练周刊》第56期:长文本理解、即时问答、掩码自监督
- Qt操作Sqlite类封装,及命令行导入csv文件到Sqlite数据库
- PE文件-手工修改重定位表-WinHex-CFF Explorer
- 深析C语言的灵魂 -- 指针
- Photoshop插件-charIDToTypeID-PIStringTerminology.h-不同值的解释及参考-脚本开发-PS插件
猜你喜欢

你是什么时候对深度学习失去信心的?

论文理解:“Self-adaptive loss balanced Physics-informed neural networks“

OpenInfra Days China 2022 |StreamNative 翟佳、刘德志受邀分享

Jenkins - 持续集成介绍(1)
![[C language] In-depth analysis of data storage in memory](/img/7c/a277657a85cc0e29db8df919439949.png)
[C language] In-depth analysis of data storage in memory

In-depth analysis of the soul of C language -- pointer

直接选择排序

基于FPGA的FIR滤波器的实现(1)—采用fir1函数设计

【黑马早报】巴菲特罕见巨亏近3000亿;周鸿祎回应360不能卸载;三亚倡议酒店不变相提高房价;首个国产抗新冠口服药定价不超300元...

changes not staged for commit 解决办法
随机推荐
xxd命令(反编译、二进制文件转十六进制文件)
医药行业转型发展,探索数字化供应链升级之道
将小部分源码设计精髓带入到开发中来(工厂模式、适配器模式、抽象类、监听器)
win32&mfc————win32菜单栏&库
MapStruct入门使用
Implementation of FIR filter based on FPGA (1) - using fir1 function design
八月粉丝福利来了!大疆手机云台你爱了吗?
行业领先的界面开发组件DevExpress 8月发布新版——v22.1.4
Program Environment and Preprocessing
AfterEffect插件-图层排序-js脚本开发-AE插件
清华|GLM-130B:一个开放的双语预训练模型
[界面开发]DevExpress WinForms流程图控件——XtraDiagrams组件入门指南
干货满满,中科院信工所于静新课帮你get学术研究与论文写作技能
Kotlin系列之let、with、run、apply、also函数的使用
Thesis understanding: "Self-adaptive loss balanced Physics-informed neural networks"
2022-08-04
看到这个应用上下线方式,不禁感叹:优雅,太优雅了!
华谊“在劫难逃”,4年亏掉64亿
腾讯,投了个 “离诺贝尔奖最近的华人”
基于FPGA的FIR滤波器的实现(1)—采用fir1函数设计