随笔分类 - 搜索
摘要:显然是一道广搜模板题; 代码: 1 #include<iostream> 2 #include<cstdio> 3 #include<queue> 4 #include<cstring> 5 using namespace std; 6 7 struct zkw{ 8 int x; //所在位置的横
阅读全文
摘要:洛谷上标签显示算法是 bfs,所以肯定是用广搜啦。 我的思路是在所给的方针外在添一圈0;也就是这样: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 1 1 0 0 1 0 0 1 1 0 0 0 1 0 0 1 0 0 0 0 1 0 0 1
阅读全文
摘要:这个题是在搜索与回溯中的,但我也没有想到用搜索,用了递归。 其实递归我并不是很会用,只是通过这个题更深刻了解递归。 函数: 1 int f(int m,int n) 2 { 3 if(m==0||n==1) 4 return 1; 5 if(n>m) 6 return f(m,m); 7 else
阅读全文

浙公网安备 33010602011771号