码迷,mamicode.com
首页 >  
搜索关键字:bfs    ( 5296个结果
POJ - 2688 Cleaning Robot
题意:求回收所有垃圾的最短路 思路:先BFS处理两个垃圾的距离,然后DFS记忆化搜索           dp[i][state]表示处理到第i个后状态是state的最短路 #include #include #include #include #include #include using namespace std; const int MAXN = 30; const in...
分类:其他好文   时间:2014-06-19 12:55:30    阅读次数:412
经典图算法Java代码实践:BFS,DFS以及几种最短路径算法
public class City { String name; int id; static int idCounter = 0; public City(String name) { this.name=name; id = idCounter++; } } import java.util.ArrayList; public class Gr...
分类:编程语言   时间:2014-06-19 10:36:26    阅读次数:196
USACO抓牛catchcow (bfs)
这题是黄巨大出的比赛题.http://poj.org/problem?id=3278DescriptionFarmer John has been informed of the location of a fugitive cow and wants to catch her immediatel...
分类:其他好文   时间:2014-06-19 00:58:53    阅读次数:510
POJ 3278 Catch That Cow(BFS 剪枝)
题目链接:http://poj.org/problem?id=3278 这几次都是每天的第一道题都挺顺利,然后第二道题一卡一天。 = =,今天的这道题7点40就出来了,不知道第二道题在下午7点能不能出来。0 0 先说说这道题目,大意是有个农夫要抓牛,已知牛的坐标,和农夫位置。而且农夫有三种移动方式,X + 1,X - 1,X * 2,问最少几步抓到牛。 开始认为很简单的,三方向的BFS就能顺...
分类:其他好文   时间:2014-06-15 16:42:30    阅读次数:232
NYOJ 284 坦克大战 【BFS】+【优先队列】
坦克大战 时间限制:1000 ms  |  内存限制:65535 KB 难度:3 描述 Many of us had played the game "Battle city" in our childhood, and some people (like me) even often play it on computer now.  What we are dis...
分类:其他好文   时间:2014-06-14 14:30:01    阅读次数:274
NYOJ92 图像有用区域 【BFS】
//在外面加一圈非0,再广搜 #include #include using std::queue; int t, w, h, arr[962][1442]; int mov[][2] = {-1, 0, 0, 1, 1, 0, 0, -1}; queue Q; bool check(int x, int y){ if(x h + 1 || y > w + 1) return 0;...
分类:其他好文   时间:2014-06-14 10:06:32    阅读次数:276
三维bfs(HUD1253胜利大逃亡)
#include #include int map[51][51][51];int v[51][51][51];int a,b,c,t11;struct node{ int x,y,z,ans;}q[200001];int jx[6]={0,0,0,0,-1,1};int jy[6]={0,0...
分类:其他好文   时间:2014-06-13 17:10:39    阅读次数:157
POJ 2049— Finding Nemo(三维BFS)10/200
这个题开始不会建图,彻底颠覆以前我对广搜题的想法。想了好久, 忽然想到省赛时HYPO让我做三维BFS来着,一直没做,看到POJ计划这个题,就是三维BFS解题,就做了一下, 对于这个题。。。。实在不知道说什么好,又坑、又SB,POJ的后台数据和题目描述的完全不一样,看了DIscuss之后开始 改动代码,最后改的又臭又长,卡了整整两天。 挥挥洒洒 160行。。。。同时也是我第一次使用  三维建图+B...
分类:其他好文   时间:2014-06-10 14:20:15    阅读次数:326
POJ - 1376 Robot
题意:求在可以一秒沿着既定方向走1到3步和向左或右转90度的情况下,从起点到终点的最短时间 思路:坑的是这机器人还有体积,所以不能走到边界,然后就是单纯的BFS #include #include #include #include #include using namespace std; const int MAXN = 110; struct node { int x,y;...
分类:其他好文   时间:2014-06-10 07:59:51    阅读次数:256
UVA 10085(bfs+康拓展开)八数码问题
Description Problem A The Most Distant State Input: standard input Output: standard output   The 8-puzzle is a square tray in which eight square tiles are placed. The remaining ninth square ...
分类:其他好文   时间:2014-06-10 07:59:06    阅读次数:335
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!