![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
DFS
AioRos128
加油
展开
-
宝岛探险
dfs问题,宝岛探险,求出所在岛屿的面积#includeusing namespace std;const int maxn=200;int next[4][2]={{0,1},{1,0},{0,-1},{-1,0}};//右,下,左,上int map[maxn][maxn];//宝岛地图 int flag[maxn][maxn]; //标记int sx,sy;//开始坐标int原创 2016-04-25 13:45:50 · 720 阅读 · 0 评论 -
皇后问题
//一个变化问题,要输出指定的皇后序列//注释里的那段代码效率比较低//去掉m变量就是n皇后问题#includeusing namespace std;int n=8,m;int c[10];int vis[10][100];void dfs(int cur){ if(cur==n && (m--==1) ) { for(int i=0;i<n;i++) cout<<c原创 2016-04-20 13:20:17 · 349 阅读 · 0 评论 -
填格子
#include #include #include #include #include using namespace std;int flag[3][4]; ///判断每个位置是否可以放数bool vis[10];int a[3][4]; ///每个位置进行放数int sum = 0;int s[8][2] = {{转载 2017-03-25 11:28:23 · 570 阅读 · 0 评论