QOJ.ac

QOJ

実行時間制限: 1 s メモリ制限: 512 MB 満点: 100

#14064. 扫雷

統計

一个无线电控制的扫雷机器人被派去排除一片雷区。

突然爆发的磁暴干扰了向机器人发送指令的传输。扫雷机器人停止响应并开始混乱地移动。如果控制无法恢复,机器人最终会撞上地雷并爆炸。为了将机器人从危险的雷区中解救出来,我们需要一个周密的救援计划。你在规划救援行动中的任务是估算我们有多少时间可以采取行动。

雷区非常辽阔,在你的计算中,你可以将其视为一个在各个方向上无限延伸的笛卡尔平面。地雷位于与坐标轴平行的规则网格的节点上。原点处有一个网格节点。网格垂直线之间的距离为 $N$ 个单位,水平线之间的距离为 $M$ 个单位。该网格的每一个节点上都有一颗地雷。

受磁暴影响,机器人的移动方式如下。每一秒,它有 $p\%$ 的概率向右移动一个单位,即从 $(x, y)$ 移动到 $(x + 1, y)$。或者,它有 $(100 - p)\%$ 的概率向上移动一个单位,即从 $(x, y)$ 移动到 $(x, y + 1)$。

当失去控制时,扫雷机器人位于坐标为 $(x_{\text{start}}, y_{\text{start}})$ 的点。

你的任务是计算机器人撞上地雷爆炸前的期望时间(秒)。

输入格式

输入只有一行,包含五个整数:$N, M, x_{\text{start}}, y_{\text{start}}$ 和 $p$($2 \le N, M \le 400$,$0 \le x_{\text{start}}, y_{\text{start}} \le 10^6$,$1 \le p \le 99$)。

保证 $(x_{\text{start}}, y_{\text{start}})$ 处没有地雷。

输出格式

输出只有一行,写出机器人撞上地雷爆炸前的期望时间(秒),绝对误差或相对误差不超过 $10^{-6}$。

样例

输入样例 1

2 2 1 1 50

输出样例 1

4.0000000000

输入样例 2

2 3 7 7 25

输出样例 2

6.8299319728

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.