![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
深度优先搜索(dfs)
文章平均质量分 82
GKHack
这个作者很懒,什么都没留下…
展开
-
ACdream1015 Double Kings(dfs)
Problem DescriptionOur country is tree-like structure, that is to say that N cities is connected by exactly N - 1 roads.The old king has two little sons. To make everything fairly, he dicided to原创 2015-08-09 09:57:46 · 1030 阅读 · 0 评论 -
HDOJ1175 连连看(dfs)
连连看Time Limit: 20000/10000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 25057 Accepted Submission(s): 6195Problem Description“连连看”相信很多人都玩过。没玩过也没原创 2015-08-21 08:32:33 · 959 阅读 · 0 评论 -
POJ2488 A Knight's Journey(dfs)
DescriptionBackground The knight is getting bored of seeing the same black and white squares again and again and has decided to make a journey around the world. Whenever a knight moves, it is原创 2015-08-05 15:11:28 · 927 阅读 · 0 评论 -
Openjudge1288 The Rotation Game(dfs)
总时间限制: 15000ms 内存限制: 150000kB描述The rotation game uses a # shaped board, which can hold 24 pieces of square blocks (see Fig.1). The blocks are marked with symbols 1, 2 and 3, with exactly 8 piece原创 2015-08-05 16:32:42 · 1265 阅读 · 0 评论 -
Openjudge 6048泰国佛塔(dfs)
描述泰囧,大家应该都看过。不知道大家有没有注意到宝宝虔诚祈福的寺庙里的金灿灿的佛塔。 众所周知,泰国佛塔外面是贴金的,而且金箔过一段时间需要修补。泰国经济自上世纪末就不景气,贴金的开支对于寺庙来说也是个比较大的负担。 这里请同学来帮助寺庙设计下佛塔的模型,以使佛塔的外表面(最下层的下底面除外)的面积最小。从而节省金箔开支。 这里抽象佛塔形状为,原创 2015-08-05 16:28:06 · 1820 阅读 · 0 评论 -
数据结构实验3(图的DFS和BFS实现)
实现邻接矩阵和邻接表两种不同存储结构上实现图的基本运算, 在MGraph类中扩充增加DFS()和BFS()函数.包含的运算: 插入一条边, 删除一条边, 查询边是否存在, 图的深度优先搜索和广度优先搜索.广度优先搜索利用队列作为辅助的数据结构, 元素类型是树的结点. 实现代码:#include "iostream"#include "cstdio"#include "cstri原创 2015-12-13 17:51:09 · 3448 阅读 · 0 评论 -
Codeforces Round #313 (Div. 2) 560D Equivalent Strings(dos)
D. Equivalent Stringstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputToday on a lecture about strings Gera原创 2015-12-18 17:08:25 · 1469 阅读 · 0 评论 -
BestCoder Round #64 (div.2) HDOJ5587 Array(dfs)
ArrayTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 490 Accepted Submission(s): 235Problem DescriptionVicky is a magician原创 2015-12-04 00:00:23 · 968 阅读 · 0 评论 -
Codeforces Round #297 (Div. 2) 525D Arthur and Walls(dfs)
D. Arthur and Wallstime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputFinally it is a day when Arthur has eno原创 2015-12-23 23:42:56 · 709 阅读 · 0 评论 -
Codeforces Round #297 (Div. 2) 525E Anya and Cubes(dfs)
E. Anya and Cubestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAnya loves to fold and stick. Today she d原创 2015-12-24 00:08:32 · 874 阅读 · 0 评论 -
FZU1920 Left Mouse Button(dfs)
Problem 1920 Left Mouse ButtonAccept: 385 Submit: 719Time Limit: 1000 mSec Memory Limit : 32768 KB Problem DescriptionMine sweeper is a very popular small game in Windows operating原创 2015-12-08 16:34:06 · 1282 阅读 · 0 评论 -
HDOJ1796 How many integers can you find(dfs+容斥)
How many integers can you findTime Limit: 12000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 6048 Accepted Submission(s): 1735Problem Descripti原创 2015-12-08 20:37:31 · 1009 阅读 · 0 评论 -
Codeforces Round #336 (Div. 2) 608D Zuma(dfs+dp)
D. Zumatime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputGenos recently installed the game Zuma on his phone原创 2015-12-27 18:32:46 · 1057 阅读 · 0 评论 -
Manthan, Codefest 16 633C Spy Syndrome 2(dfs + stl)
C. Spy Syndrome 2time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAfter observing the results of Spy Syndro原创 2016-02-28 08:27:26 · 1338 阅读 · 0 评论 -
POJ1011 Sticks(dfs)
Description乔治拿来一组等长的木棒,将它们随机地砍断,使得每一节木棍的长度都不超过50个长度单位。然后他又想把这些木棍恢复到为裁截前的状态,但忘记了初始时有多少木棒以及木棒的初始长度。请你设计一个程序,帮助乔治计算木棒的可能最小长度。每一节木棍的长度都用大于零的整数表示。Input输入包含多组数据,每组数据包括两行。第一行是一个不超过64的整数,表示砍断之后共有多少节原创 2015-08-05 11:04:13 · 987 阅读 · 0 评论 -
POJ1321 棋盘问题(dfs)
Description在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。Input输入含有多组测试数据。 每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在一个n*n的矩阵内描述棋盘,以及摆放棋子的数目。 n原创 2015-08-05 15:18:57 · 944 阅读 · 0 评论 -
BestCoder Round #53 (div.2) HDOJ5424 Rikka with Graph II(dfs & 哈密顿通路判断)
Rikka with Graph IITime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 717 Accepted Submission(s): 174Problem DescriptionAs we kn原创 2015-08-30 19:58:05 · 844 阅读 · 0 评论 -
ACdream1726 A Math game(dfs)
A Math gameTime Limit: 2000/1000MS (Java/Others) Memory Limit: 256000/128000KB (Java/Others)Submit Statistic Next ProblemProblem DescriptionRecently, Losanto find an interesting Math原创 2015-08-31 00:23:19 · 1065 阅读 · 0 评论 -
POJ2676 Sudoku(dfs)
SudokuTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 16161 Accepted: 7894 Special JudgeDescriptionSudoku is a very simple task. A square table wi原创 2015-09-09 16:56:44 · 1024 阅读 · 0 评论 -
Codeforces Round #321 (Div. 2) 580C Kefa and Park(dfs)
题目链接:第一行给你n、m,接下来的一行有n个数,如果为1则代表这个点有cat,接下来的n-1行每行给出x、y,表示x、y相连。问你从1出发能到达的叶子结点有几个,要求到达叶子结点的路上连续有cat的点不超过m。a数组保存结点是否含有cat,从1这个点开始dfs,每次dfs对cat数组操作,记录连续的含有cat的点数,回溯时再判断当前结点是否满足条件,要求结点为叶子原创 2015-09-24 19:44:51 · 1922 阅读 · 0 评论 -
POJ1111 Image Perimeters(dfs)
Image PerimetersTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 8400 Accepted: 5030DescriptionTechnicians in a pathology lab analyze digitized images原创 2015-09-10 06:55:06 · 1058 阅读 · 0 评论 -
POJ2337 Catenyms(欧拉回路+dfs)
CatenymsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 10533 Accepted: 2754DescriptionA catenym is a pair of words separated by a period such that th原创 2015-09-05 17:07:15 · 1161 阅读 · 0 评论 -
POJ2230 Watchcow(欧拉回路 + dfs)
WatchcowTime Limit: 3000MS Memory Limit: 65536KTotal Submissions: 6493 Accepted: 2829 Special JudgeDescriptionBessie's been appointed the new watch-cow for原创 2015-09-05 09:04:33 · 1061 阅读 · 0 评论 -
HDOJ5305 Friends(dfs)
FriendsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1797 Accepted Submission(s): 903Problem DescriptionThere are n people原创 2015-08-29 18:19:18 · 758 阅读 · 0 评论 -
POJ1041 John's trip(欧拉回路 + 并查集 + dfs)
John's tripTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 7856 Accepted: 2644 Special JudgeDescriptionLittle Johnny has got a new car. He decided原创 2015-09-04 16:06:28 · 1130 阅读 · 0 评论 -
POJ3321 Apple Tree(树状数组 + dfs + 线性表)
Apple TreeTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 21885 Accepted: 6634DescriptionThere is an apple tree outside of kaka's house. Every autumn,原创 2015-09-03 14:32:51 · 979 阅读 · 0 评论 -
BestCoder Round #49 ($) HDOJ5339 Untitled(dfs)
InputThe first line contains one integer T≤5, which represents the number of testcases. For each testcase, there are two lines:1. The first line contains two integers n and a (1≤n≤20,1≤a原创 2015-08-09 10:05:56 · 988 阅读 · 0 评论 -
POJ2362 Square(dfs)
DescriptionGiven a set of sticks of various lengths, is it possible to join them end-to-end to form a square?InputThe first line of input contains N, the number of test cases. Each test case原创 2015-08-05 09:08:40 · 849 阅读 · 0 评论 -
IndiaHacks 2016 - Online Edition (Div. 1 + Div. 2) 653B Bear and Compressing(dfs + stl)
B. Bear and Compressingtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputLimak is a little polar bear. Polar原创 2016-03-25 11:11:48 · 766 阅读 · 1 评论