
DFS
文章平均质量分 58
elorole
细磨专研
展开
-
洛谷 P1101 单词方阵(dfs)
题目链接:https://www.luogu.org/problemnew/show/P1101 DFS 题目描述:给一nXn的字母方阵,内可能蕴含多个“yizhong”单词。单词在方阵中是沿着同一方向连续摆放的。摆放可沿着8个方向的任一方向,同一单词摆放时不再改变方向,单词与单词之间[color=red]可以[/color]交叉,因此有可能共用字母。输出时,将不是单词的字母用“*”代替,以突...原创 2018-03-18 09:59:52 · 603 阅读 · 0 评论 -
HDU 1455 sticks(dfs+剪枝)
一道经典的dfs题。锻炼一下剪枝的能力。 链接:http://acm.hdu.edu.cn/showproblem.php?pid=1455 题面: Problem DescriptionGeorge took sticks of the same length and cut them randomly until all parts became at most 50 units l...原创 2018-03-19 23:18:20 · 184 阅读 · 0 评论 -
例题6-12-Oil Deposits-UVa 572
题目描述:: **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...原创 2018-04-02 20:43:52 · 201 阅读 · 0 评论 -
洛谷 P1135 奇怪的电梯 (搜索)
题目链接:https://www.luogu.org/problemnew/show/P1135 题意:从电梯的某一层到另一层,只不过这个电梯有点不一样,每层只能上或下指定的层数k[i],计算最少的按键次数. 思路: 搜索吧…不会其他的(以后会了再来补充). 代码如下:#include <iostream>#include <cstdio>#include &...原创 2018-04-11 11:36:08 · 360 阅读 · 0 评论 -
洛谷 P1141 01迷宫 (dfs)
题目链接:https://www.luogu.org/problemnew/show/P1141 题意:给一个n*n的仅由01 构成的迷宫,输出从某一点出发所能走到的最多格子,如果所处方块是0,则可以走到四个方向上的1去,反之亦然。 思路: 1.如果这一格的步数已经大于0就直接输出,否则dfs,并标记,具体的看代码。 2.另外所谓的走格子规则,其实就是周围四个方向的格子跟所在的格子不等就行...原创 2018-04-12 21:52:50 · 886 阅读 · 0 评论