随笔分类 -  DFS

 
L2-016. 愿天下有情人都是失散多年的兄妹(深搜)*
摘要:L2-016. 愿天下有情人都是失散多年的兄妹 参考博客 阅读全文
posted @ 2018-03-31 06:55 Annetree 阅读(362) 评论(0) 推荐(0)
HDU 6060 17多校3 RXD and dividing(树+dfs)
摘要:Problem Description RXD has a tree T, with the size of n. Each edge has a cost.Define f(S) as the the cost of the minimal Steiner Tree of the set S on 阅读全文
posted @ 2017-08-10 10:44 Annetree 阅读(254) 评论(1) 推荐(0)
什么时候用深搜(dfs)什么时候用广搜(bfs)(转)
摘要:1.BFS是用来搜索最短径路的解是比较合适的,比如求最少步数的解,最少交换次数的解,因为BFS搜索过程中遇到的解一定是离根最近的,所以遇到一个解,一定就是最优解,此时搜索算法可以终止。这个时候不适宜使用DFS,因为DFS搜索到的解不一定是离根最近的,只有全局搜索完毕,才能从所有解中找出离根的最近的解 阅读全文
posted @ 2017-07-18 11:03 Annetree 阅读(2337) 评论(0) 推荐(1)
POJ 1321 棋盘问题 (dfs)
摘要:在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。 Input 输入含有多组测试数据。 每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将 阅读全文
posted @ 2017-07-18 10:20 Annetree 阅读(171) 评论(0) 推荐(0)
ZUFEOJ 2395 天棋哥哥大战AlphGo
摘要:Description3月15日,人机围棋大战巅峰对决在韩国首尔落下帷幕。五番棋的最后一局中,韩国著名棋手李世乭尽管与人工智能“AlphaGo”缠斗至官子阶段,但在双双进入读秒后最终还是投子认输,以总比分1∶4结束了这场举世瞩目的人机大战。100年后的某一天,天棋哥哥为了给李世乭报仇,挽回人类尊严, 阅读全文
posted @ 2016-07-17 19:59 Annetree 阅读(288) 评论(0) 推荐(0)
HDU 1518 Square(DFS)
摘要:Problem Description Given a set of sticks of various lengths, is it possible to join them end-to-end to form a square? Input The first line of input c 阅读全文
posted @ 2016-07-11 15:26 Annetree 阅读(161) 评论(0) 推荐(0)
HDU 1501 Zipper(DFS)
摘要:Problem Description Given three strings, you are to determine whether the third string can be formed by combining the characters in the first two stri 阅读全文
posted @ 2016-07-09 10:28 Annetree 阅读(138) 评论(0) 推荐(0)
HDU 2181 哈密顿绕行世界问题(DFS)
摘要:Problem Description 一个规则的实心十二面体,它的 20个顶点标出世界著名的20个城市,你从一个城市出发经过每个城市刚好一次后回到出发的城市。 Input 前20行的第i行有3个数,表示与第i个城市相邻的3个城市.第20行以后每行有1个数m,m<=20,m>=1.m=0退出. Ou 阅读全文
posted @ 2016-07-07 00:26 Annetree 阅读(157) 评论(0) 推荐(0)
HDU 1045 Fire Net (DFS)
摘要:Problem Description Suppose that we have a square city with straight streets. A map of a city is a square board with n rows and n columns, each repres 阅读全文
posted @ 2016-07-05 20:45 Annetree 阅读(175) 评论(0) 推荐(0)
HDU 2212 DFS
摘要:Problem Description A DFS(digital factorial sum) number is found by summing the factorial of every digit of a positive integer. For example ,consider 阅读全文
posted @ 2016-07-04 21:59 Annetree 阅读(137) 评论(0) 推荐(0)
HDU 1241Oil Deposits (DFS)
摘要:Problem Description The GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one large re 阅读全文
posted @ 2016-07-04 21:54 Annetree 阅读(138) 评论(0) 推荐(0)
HDU 1312 Red and Black (DFS)
摘要:Problem Description There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black til 阅读全文
posted @ 2016-07-04 21:52 Annetree 阅读(134) 评论(0) 推荐(0)
HDU 1010 Tempter of the Bone(DFS+奇偶剪枝)
摘要:Problem Description The doggie found a bone in an ancient maze, which fascinated him a lot. However, when he picked it up, the maze began to shake, an 阅读全文
posted @ 2016-07-03 23:02 Annetree 阅读(166) 评论(0) 推荐(0)