![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
搜索--DFS
AliceBuJu
这个作者很懒,什么都没留下…
展开
-
【codevs 1569】最佳绿草
dfs.#include<cstdio> #include<iostream> #include<cstring> #include<algorithm> using namespace std; int n,m; int cnt=0; const int maxn=105; int map[maxn][maxn]; int nx[]={0,1,0,-1}; int ny[]={1,0,-1,0};原创 2017-08-17 19:50:06 · 305 阅读 · 0 评论 -
【codevs 1039】数的划分&&【Openjudge 666】放苹果
DFS 数的划分#include<cstdio> #include<iostream> #include<cmath> #include<cstring> using namespace std; int n,m; int cnt=0; void HF(int a,int b,int c) { if(b==1) { cnt++; return;原创 2017-10-14 21:24:44 · 486 阅读 · 0 评论 -
【codevs 1004】四子连棋
bfs。 1000007不是个质数。 Hash的时候需要判一下最后一次下的棋子颜色。(不然过不了样例,虽然能A……) 注意交换顺序。 zz代码↓#include<cstdio> #include<iostream> #include<cstring> #include<queue> #include<algorithm> using namespace std; string a; int原创 2017-11-07 08:13:38 · 399 阅读 · 0 评论 -
【codevs 1026】逃跑的拉尔夫
BFS+判重(used数组判断有没有用相同k步走到该点)#include<cstdio> #include<iostream> #include<algorithm> #include<queue> #include<cstring> using namespace std; struct place { int x,y; }; queue<string> q; queue<place> p原创 2017-09-13 20:10:30 · 234 阅读 · 0 评论