![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
bfs相关笔记
大橘为重eleven
每天都因为自己太菜了而自闭
展开
-
跑图
跑图题目描述跑图是RPG游戏中很烦躁的事情。玩家需要跑到距离他最近的传送点的位置。现在给你一张N × M的方格图,每个方格中数值0表示为平地,数值1表示为传送点,你的任务是输出一张 N × M 的矩阵, Matrixxy表示从 (x, y) 到距离它最近的传送点的距离。 这里的距离是曼哈顿距离,(x1, y1)→ (x2, y2) 的距离为∣x1 − x2∣ + ∣y1 − y2 ...原创 2019-04-17 19:53:17 · 495 阅读 · 0 评论 -
Pots
题目描述:You are given two pots, having the volume of A and B liters respectively. The following operations can be performed:1.FILL(i) fill the pot i (1 ≤ i ≤ 2) from the tap;2.DROP(i) empt...原创 2019-07-31 08:59:53 · 248 阅读 · 0 评论 -
Oil Deposits
题目描述:The GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one large rectangular region of land at a time, and creates a grid that divi...原创 2019-07-31 09:04:10 · 135 阅读 · 0 评论 -
Farthest Nodes in a Tree
题目描述:Given a tree (a connected graph with no cycles), you have to find the farthest nodes in the tree. The edges of the tree are weighted and undirected. That means you have to find two nodes in the ...原创 2019-07-31 09:12:21 · 258 阅读 · 0 评论 -
连连看
题目描述:“连连看”相信很多人都玩过。没玩过也没关系,下面我给大家介绍一下游戏规则:在一个棋盘中,放了很多的棋子。如果某两个相同的棋子,可以通过一条线连起来(这条线不能经过其它棋子),而且线的转折次数不超过两次,那么这两个棋子就可以在棋盘上消去。不好意思,由于我以前没有玩过连连看,咨询了同学的意见,连线不能从外面绕过去的,但事实上这是错的。现在已经酿成大祸,就只能将错就错了,连线不能从外围绕过。...原创 2019-07-31 09:24:31 · 149 阅读 · 0 评论 -
Mountain Walking
题目描述:Farmer John and Bessie the cow have embarked on one of those ‘active’ vacations. They spend entire days walking in the mountains and then, at the end of the day, they tire and return to their va...原创 2019-07-31 09:29:40 · 194 阅读 · 0 评论 -
Borg Maze (BFS+最小生成树)
题目描述:The Borg is an immensely powerful race of enhanced humanoids from the delta quadrant of the galaxy. The Borg collective is the term used to describe the group consciousness of the Borg civilizat...原创 2019-08-14 21:19:31 · 256 阅读 · 0 评论