HBC14624Piglet treasure hunt Series 1题解

庄子墨 算法基础篇 32 0
挑战自我,勇攀编程高峰!全网最全C++题库,助您成为编程达人。
Once there was a pig, which was very fond of treasure hunting. The treasure hunt is risky, and it is inadvertently caught in the peach blossom trap. Fortunately, it has got a map of peach blossom trap. You can think of it as a matrix of R rowand C column. ‘.’ stand for the road you can walk. ‘*’ means there is a peach tree planted in this grid, and obviously you can’t go into it. Thepig can only walk up to four adjacent squares in the upper, lower, left and right directions at a time. The outside of the matrix is the paradise of freedom, and of course, it may never go out. Though it has got the map, but doesn't know where it is in the peach blossom trap now,that means it could be at any ‘.’ in the matrix. It finds you smart to tell it the probability it can get out of peach blossom trap, please tell him the answer in the formof p/q.

Once there was a pig, which was very fond of treasure hunting. The treasure hunt is risky, and it is inadvertently caught in the peach blossom trap. Fortunately, it has got a map of peach blossom trap. You can think of it as a matrix of R row and C column. ‘.’ stand for the road you can walk. ‘*’ means there is a peach tree planted in this grid, and obviously you can’t go into it. The pig can only walk up to four adjacent squares in the upper, lower, left and right directions at a time. The outside of the matrix is the paradise of freedom, and of course, it may never go out. Though it has got the map, but doesn't know where it is in the peach blossom trap now, that means it could be at any ‘.’ in the matrix. It finds you smart to tell it the probability it can get out of peach blossom trap, please tell him the answer in the form of p/q. 

HBC14624Piglet treasure hunt Series 1题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
不断挑战自我,才能突破极限!全网最全C++题库,让您在编程道路上越走越远。

标签: HBC14624Piglet treasure hunt Series 1题解