
搜索
文章平均质量分 66
chinnmt
这个作者很懒,什么都没留下…
展开
-
poj 2386lake counting(水水的dfs)
#include char map[101][101];int dx[8]={-1,-1,-1,0,0,1,1,1};int dy[8]={-1,0,1,-1,1,-1,0,1};int n, m;void dfs(int x, int y){ int i, j; int rx, ry; map[x][y]='.'; for(i=0; i<8; i++)原创 2014-05-15 19:32:23 · 563 阅读 · 0 评论 -
bfs及dfs模版
DFS:/*该DFS框架以2D坐标范围为例,来体现DFS算法的实现思想。*/#include#include#includeusing namespace std;const int maxn=100;bool vst[maxn][maxn]; // 访问标记int map[maxn][maxn]; // 坐标范围int dir[4][2]={0,1,0,-1转载 2014-05-09 21:05:02 · 564 阅读 · 1 评论 -
hdu 1010 Tempter of the Bone(dfs)
题意:狗狗在S位置,门在D位置,让狗狗走到门那里要刚好yong'sh原创 2014-05-10 10:00:18 · 501 阅读 · 0 评论 -
hdu 1175 连连看
#include #include int n, m, d, q;int x1,x2,y1,y2;int field[1001][1001];bool vis[1001][1001], flag;void dfs(int x,int y, int d, int step){ if(flag) return; if(xn||ym) return ; if(step>2) ret原创 2014-05-15 23:24:05 · 542 阅读 · 0 评论 -
hdu 2952Counting Sheep
#include int d[4][2]={1,0,-1,0,0,1,0,-1};char field[101][101];int n,m;void dfs(int x, int y){ int i,xx,yy; for(i=0; i<4; i++) { xx=x+d[i][0]; yy=y+d[i][1]; if(xxn||yy>m||fiel原创 2014-05-18 23:56:20 · 708 阅读 · 0 评论 -
hdu 1015Safecracker(dfs)
#include #include #include int vis[15], in[15];char str[15], ans[15];int chen, len;int cmp(const void *a, const void *b){ return *(char *)b-*(char *)a;}int dfs(int num){原创 2014-05-11 22:54:38 · 479 阅读 · 0 评论 -
hdu 1072Nightmare(bfs)
#include #include #include using namespace std;int n,m,sx,sy;int dir[4][2]={{0,1},{0,-1},{1,0},{-1,0}};int maze[10][10];struct node{ int x,y,step,time;}pre,rear;int isok(int x,int y){原创 2014-05-12 22:09:26 · 494 阅读 · 0 评论 -
hdu 1045 Fire Net(dfs)
The goal is to place as many blockhouses in a city as possible so that no two can destroy each other. A configuration of blockhouses is legal provided that no two blockhouses are on the same horizonta原创 2014-05-12 20:14:42 · 558 阅读 · 0 评论 -
hdu 1035 Robot Motion
题意: 给出行,列,和开始在第一列列原创 2014-07-02 17:09:53 · 458 阅读 · 0 评论