bfs
文章平均质量分 54
Gusugureng
这个作者很懒,什么都没留下…
展开
-
[Offer收割]编程练习赛9 B题 水陆距离
题目2 : 水陆距离 时间限制:10000ms 单点时限:1000ms 内存限制:256MB描述给定一个N x M的01矩阵,其中1表示陆地,0表示水域。对于每一个位置,求出它距离最近的水域的距离是多少。 矩阵中每个位置与它上下左右相邻的格子距离为1。 输入第一行包含两个整数,N和M。以下N行每行M个0或者1,代表地图。数据保证至少有1块水域。对于30%的数据,1 <= N, M <= 1原创 2017-03-12 21:40:16 · 738 阅读 · 0 评论 -
HDU1548 A strange lift
马上蓝桥杯了,找了些bfs的题目练练手,因为作死报的java组,实在是有些惶恐 There is a strange lift.The lift can stop can at every floor as you want, and there is a number Ki(0 <= Ki <= N) on every floor.The lift have just two butt原创 2017-04-02 18:15:51 · 489 阅读 · 0 评论 -
HDU 1372Knight Moves
A friend of you is doing research on the Traveling Knight Problem (TKP) where you are to find the shortest closed tour of knight moves that visits each square of a given set of n squares on a chessboar原创 2017-04-02 19:25:14 · 449 阅读 · 0 评论 -
HDU 2717 Catch That Cow
Farmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a point N (0 ≤ N ≤ 100,000) on a number line and the cow is at a point K (0 ≤ K ≤ 100,00原创 2017-04-02 20:07:50 · 523 阅读 · 0 评论