
DFS
Soar-
这个作者很懒,什么都没留下…
展开
-
POJ1979 Red and Black【DFS】
水题,直接代码! #include<iostream>#include<cstdio>#include<algorithm>using namespace std;#define MAX_M 22#define MAX_N 22char m[MAX_M][MAX_N];int M, N, ans;//定义四个移动方向int dx[4] = { 1,-1,0,0};int dy[4原创 2017-11-15 19:29:12 · 282 阅读 · 0 评论 -
POJ 2386---水洼
水题,直接代码!#include<iostream>#include<algorithm>#include<cstdio>#include<stdlib.h>#define MAX_N 101#define MAX_M 101using namespace std;int N, M;char field[MAX_N][MAX_M];void dfs(int x, int y){原创 2017-11-15 19:34:26 · 437 阅读 · 0 评论 -
POJ3009---冰壶游戏(深搜剪枝+回溯)
这道题题意还是需要仔细去理解的。 1.虽然求最短路径,但是这道题用广搜很难实现,因为棋盘在改变。题目有说steps要小于10也在提示用深搜,已经给了剪枝。 2.这道题太多细节,每次撞击才算是一次相邻的元素访问。起点 的时候周围不能有障碍物,~~~。void dfs(int x, int y){ if (steps == 10) return; for (int原创 2017-11-16 15:52:08 · 533 阅读 · 0 评论 -
06-图2 Saving James Bond - Easy Version(25 分)---DFS
06-图2 Saving James Bond - Easy Version(25 分)This time let us consider the situation in the movie "Live and Let Die" in which James Bond, the world's most famous spy, was captured by a group of原创 2017-12-01 21:56:20 · 427 阅读 · 0 评论 -
HDU---1427(24点游戏,DFS回溯)
题意:速算24点相信绝大多数人都玩过。就是随机给你四张牌,包括A(1),2,3,4,5,6,7,8,9,10,J(11),Q(12),K(13)。要求只用'+','-','*','/'运算符以及括号改变运算顺序,使得最终运算结果为24(每个数必须且仅能用一次)。游戏很简单,但遇到无解的情况往往让人很郁闷。你的任务就是针对每一组随机产生的四张牌,判断是否有解。我们另外规定,整个计算过程中都不能出原创 2018-02-03 21:36:58 · 586 阅读 · 0 评论