
深搜DFS
Lawliet_ZMZ
ACMERandNODER
展开
-
啊哈算法_全排列
#include #include using namespace std;int a[10],book[10],n;void dfs(int step) //step表示站在第几个盒子面前{ int i; if(step==n+1) { for(i=1;i<=n;i++) cout<<a[i]; cout原创 2016-07-29 16:01:59 · 1671 阅读 · 0 评论 -
解救人质 DFS简单模板
解救人质,给一张二维地图,有障碍的点不能移动,给定起始点和人质坐标,求到达人质路程的最短路程,DFS模型#include #include using namespace std;int n,m,p,q,Min=99999999;int a[51][51],book[51][51];void dfs(int x,int y,int step){ int next[4][2]原创 2016-07-29 20:52:37 · 838 阅读 · 0 评论 -
POJ 2488 DFS 模拟 马的跳动
A Knight's JourneyTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 40970 Accepted: 13938DescriptionBackgroundThe knight is getting bored of seeing the sa原创 2016-08-01 15:18:18 · 372 阅读 · 0 评论 -
POJ 3083 相对位置的DFS的变形和BFS
Children of the Candy CornTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 12755 Accepted: 5481DescriptionThe cornfield maze is a popular Halloween treat.原创 2016-08-02 10:24:45 · 418 阅读 · 0 评论 -
POJ 1562深搜判断连体油田个数
http://poj.org/problem?id=1562大意:输入mp二维矩阵,规定‘@’连体的包括对角线为一片油田,统计共有多少油田。深搜方向数组dir设置8个方向遇到@继续搜索把当前位置赋值*避免重复遍历即可#include #include #include using namespace std;char mp[105][105];int m,n;int dir[原创 2016-11-11 01:33:13 · 1042 阅读 · 0 评论 -
POJ 1011 很经典的树枝拼凑的深度搜索
SticksTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 142684 Accepted: 33684DescriptionGeorge took sticks of the same length and cut them randomly until a原创 2017-03-01 22:05:14 · 496 阅读 · 0 评论 -
#1050 :求多叉树中的的最长路
#1050 : 树中的最长路时间限制:10000ms单点时限:1000ms内存限制:256MB描述上回说到,小Ho得到了一棵二叉树玩具,这个玩具是由小球和木棍连接起来的,而在拆拼它的过程中,小Ho发现他不仅仅可以拼凑成一棵二叉树!还可以拼凑成一棵多叉树——好吧,其实就是更为平常的树而已。但是不管怎么说,小Ho喜爱的玩具又升级换代了,于原创 2017-03-08 22:37:32 · 1040 阅读 · 0 评论 -
POJ 1129 深搜&四色染图&模拟
Channel AllocationTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 15241 Accepted: 7731DescriptionWhen a radio station is broadcasting over a very large area, repeaters are used to原创 2017-03-04 18:16:33 · 496 阅读 · 0 评论 -
组队赛 A Promotions 深搜+逆向思维
题意:一个公司总共n个人,m个关系,u v 表示u是v的上司,现在要提拔l个和r个人,原创 2017-05-20 18:44:01 · 363 阅读 · 0 评论