dfs
WindWalk1992
这个作者很懒,什么都没留下…
展开
-
coj 1061
题目链接:http://acm.cugb.edu.cn/showproblem.php?problemid=1061 /* COJ 1061 思路:dfs,6种颜色不必管,b数组为标记,到过为1,未到为0; 搜索,重开头开始,同一类型能dfs到的都dfs到了;*/#include#includeusing namespace std;int原创 2013-10-09 00:58:02 · 590 阅读 · 0 评论 -
poj 2386
题目链接:http://poj.org/problem?id=2386 dfs #include#includeusing namespace std;int dir[8][2]= {{0,1},{0,-1},{1,1},{1,-1},{-1,0},{-1,1},{-1,-1},{1,0}} ;//八个方向char map[105][105];int n,m原创 2013-10-09 01:01:01 · 469 阅读 · 0 评论 -
coj 1102
题目链接http://acm.cugb.edu.cn/showproblem.php?problemid=1102思路:DFS,找到标记的要计算的‘T’然后DFS找‘L’,用一次DFS后sum++;#include#includeusing namespace std;int m,n;char a[40][40];int b[40][40]={0};int sum=0;voi原创 2013-10-10 13:04:01 · 596 阅读 · 0 评论 -
poj 1562
题目链接:http://poj.org/problem?id=1562dfs,和poj2386几乎一样#include#includeusing namespace std;char map[200][200];int m,n;int dir[8][2]={{1,0},{0,1},{1,1},{1,-1},{-1,1},{-1,-1},{-1,0},{0,-1}};void原创 2013-10-10 21:43:35 · 518 阅读 · 0 评论