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

建议使用的浏览器:

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

3393:Precious

题目描述
Gollum is finding his Precious. The precious is hiding in a magic maze. The maze can be considered as a simple polygon. Some vertexes of the polygon are doors that can only allow Gollum to get in, and the other doors can only allow Gollum to get out.
Gollum doesn’t know that restrict, he choose a door to get in, and choose a door to get out after he has got his precious. Gollum hasn’t learned math, so we believe that Gollum choose the door randomly, that means if there are n doors, the probability of a door chose by Gollum is 1/n.
There is a monster in the maze, and if Gollum stay in the maze more than m minutes, the monster will wake up and eat Gollum. Gollum can move one unit distance by one minute.
We want to know the probability that Gollum got his precious.
输入解释
The input consists of multiply test cases. The first line of each test case contains two integers, n (3 <= n <= 100), m (0 <= m <= 10000), where n is the number of vertexes of the maze, and m is the time limit. The next n lines represent the maze, each line contains a coordinate, x, y (-10000 <= x, y <= 10000) and a DoorType. If DoorType equals to -1, then you can get in from this vertex; if DoorType equals to 0, then it’s not a door; if DoorType equals to 1, then you can get out from this vertex. The last line of each test case is a coordinate, indicating the location of the precious. You can assume that the precious is always in the maze.
The last test case is followed by a line containing two zeros, which means the end of the input.
输出解释
Output the probability. Please take it with 9 factional digits.
输入样例
12 4
-2 -1 -1
-1 -1 -1
-1 -2 -1
1 -2 -1
1 -1 -1
2 -1 -1
2 1 1
1 1 1
1 2 1
-1 2 1
-1 1 1
-2 1 1
0 0
0 0
输出样例
0.138888889
来自杭电HDUOJ的附加信息
Author momodi@whu
Recommend notonlysuccess

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

源链接: HDU-3393

最后修改于 2020-10-25T23:03:08+00:00 由爬虫自动更新

共提交 0

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