![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
dfs
KEIke0
这个作者很懒,什么都没留下…
展开
-
2020-09-12
简单的一刀dfs,每次把条件改为一路走到底就行了参考的博客https://www.cnblogs.com/sky-stars/p/11182542.html#include<iostream>#include<algorithm>#include<cstring>using namespace std;const int MAXN=25;int sx,sy,ex,ey;int ans;int w,h;int map[MAXN][MAXN];原创 2020-09-12 16:56:19 · 95 阅读 · 0 评论 -
Hopscotch POJ 3050
熟悉set的运用熟悉set的运用熟悉set的运用重要的事要说三遍,会set就根本不难#include<iostream>#include<algorithm>#include<set>using namespace std;int map[10][10];int dx[4]={0,1,0,-1};int dy[4]={1,0,-...原创 2019-10-21 15:44:24 · 119 阅读 · 0 评论 -
Backward Digit Sums POJ 3187
一个比较简单的全排列,用一维数组a[i]=a[i]+a[i+1],每次更新直到加到最后一次,第一个数就是总和,两种方法,一个是dfs,一个是全排列函数dfs#include<iostream>#include<algorithm>#include<cstdio> #include<cstring>using namespace s...原创 2019-10-16 21:22:45 · 126 阅读 · 0 评论 -
Smallest Difference POJ 2718
用dfs搜索出两个数字在进行比大小,用ans记录每次相减的最小结果并且输出,当需要排的数字只有1或者2个时候可以进行直接输出,其他进行dfs#include<iostream>#include<algorithm>#include<cstring>#include<cmath>#include<string>#includ...原创 2019-10-14 15:39:33 · 142 阅读 · 0 评论 -
Red and Black POJ - 1979
很简单的dfs原创 2019-09-21 10:35:15 · 87 阅读 · 0 评论 -
Property Distribution Aizu - 0118
注:提交不了,不知道正确性注:提交不了,不知道正确性注:提交不了,不知道正确性题意是一个果园,被三种树分成了几部分,相邻的树一样就是一个部分,求一共多少部分简单dfs#include<iostream>#include<algorithm>#include<cstring>using namespace std;char map...原创 2019-09-21 11:08:37 · 115 阅读 · 0 评论