当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

2644:Escape

题目描述
One night , when dandelion fell asleep , she finds herself in a big maze . Different with other mazes ,the exit of the maze is changing all the time . Now dandelion knows the maze is made up of N rooms , signed as 1,2 …n. Some of the rooms are connected with undirected ways . To escape from the maze as soon as possible , every time dandelion will move to the room which is nearest to the exit . If there are several rooms , she will choose the room with the smallest number .Meanwhile , to leave the maze more quickly ,during every unit time , after moving once if dandelion doesn’t reach the exit ,she can move once again . If dandelion still doesn’t reach the exit , the exit will move to any room that connected with it , or stay at the same room . The possibility is average . Now dandelion wants to know the average time she needs to escape from the maze. Can you help her?
输入解释
There are several cases ,every case begins with two numbers n and m (1<=n,m<=1000),stands for the number of rooms and the number of the ways . The second line contains two numbers a and b ,stands for the room where dandelion and the exit exist at the beginning . Then m lines ,each line with two numbers p and q ,stands for there is a way between room p and room q.
输出解释
For every case ,print the average time t (rounded to three places beyond the decimal point) dandelin needs to escape from the maze.
输入样例
4 3
1 4
1 2
2 3
3 4
2 1
1 1
1 2
输出样例
1.500
0.000
来自杭电HDUOJ的附加信息
Author dandelion
Recommend yifenfei

该题目是Virtual Judge题目,来自 杭电HDUOJ

题目来源 曾是惊鸿照影来

源链接: HDU-2644

最后修改于 2020-10-25T22:55:30+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 32768/32768K(Java/Others)