随笔分类 -  BFS

摘要:题目描述 给出一个 N 个顶点 M 条边的无向无权图,顶点编号为 1−N 。问从顶点 1 开始,到其他每个点的最短路有几条。 输入输出格式 输入格式: 第一行包含 22个正整数 N,M 为图的顶点数与边数。 接下来 M 行,每行 2个正整数 x,y,表示有一条顶点 x 连向顶点 y的边,请注意可能有 阅读全文
posted @ 2018-06-24 13:02 岩扉 阅读(540) 评论(0) 推荐(0)
摘要:题目描述由数字 0 组成的方阵中,有一任意形状闭合圈,闭合圈由数字 1 构成,围圈时只走上下左右 4 个方向。现要求把闭合圈内的所有空间都填写成 2 .例如: 6×6 的方阵( n=6 ),涂色前和涂色后的方阵如下: ... 阅读全文
posted @ 2018-06-10 16:37 岩扉 阅读(325) 评论(0) 推荐(0)
摘要:poj 1383 Labyrinth 【 BFS实现 树的直径裸题】 The northern part of the Pyramid contains a very large and complicated labyrinth. The labyrinth is ... 阅读全文
posted @ 2017-08-01 20:52 岩扉 阅读(263) 评论(0) 推荐(0)
摘要:Number TransformationIn this problem, you are given an integer number s. You can transform any integer number A to another integer num... 阅读全文
posted @ 2017-07-31 17:38 岩扉 阅读(369) 评论(0) 推荐(0)