随笔分类 - Algo__search
递归与迭代
DFS
BFS
回溯
搜索算法的一些优化:剪枝函数+双向广度搜索
摘要:#include "iostream" #include "cstdio" #include "cstring" #include "algorithm" #include "map" using namespace std; char a[11]; vector ans; bool visit[11]; int n; map,bool> m; void dfs(int k) { ...
阅读全文
摘要:迷宫问题 Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 20816 Accepted: 12193 Description 定义一个二维数组: int maze[5][5] = { 0, 1, 0, 0, 0, 0, 1, 0,
阅读全文
摘要:http://codeforces.com/problemset/problem/510/B
阅读全文
摘要:41 2 4 713 41 2 4 715 Yes No 积水问题:求水洼个数(8连通的积水认为连通) BFSKEY WORD:队列 近->远遍历容易用来求,最短路径,最少操作之类问题key 状态 转移方式 10 10#S######.#......#..#.#.##.##.#.#........#
阅读全文
摘要:#include "iostream" #include "cstdio" using namespace std; int dir[8][2]={{0,1},{0,-1},{1,0},{-1,0},{1,-1},{-1,1},{1,1},{-1,-1}}; int count,r,c; char map[100][100]; void dfs(int x,int y)//深搜函数,参数为坐标(...
阅读全文

浙公网安备 33010602011771号