随笔分类 -  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) { ... 阅读全文
posted @ 2017-07-20 00:00 kimsimple 阅读(138) 评论(0) 推荐(0)
摘要:迷宫问题 Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 20816 Accepted: 12193 Description 定义一个二维数组: int maze[5][5] = { 0, 1, 0, 0, 0, 0, 1, 0, 阅读全文
posted @ 2017-04-13 17:45 kimsimple 阅读(2048) 评论(0) 推荐(0)
摘要:http://codeforces.com/problemset/problem/510/B 阅读全文
posted @ 2017-04-13 16:15 kimsimple 阅读(230) 评论(0) 推荐(0)
摘要:数独 阅读全文
posted @ 2017-04-09 10:48 kimsimple 阅读(302) 评论(0) 推荐(0)
摘要:41 2 4 713 41 2 4 715 Yes No 积水问题:求水洼个数(8连通的积水认为连通) BFSKEY WORD:队列 近->远遍历容易用来求,最短路径,最少操作之类问题key 状态 转移方式 10 10#S######.#......#..#.#.##.##.#.#........# 阅读全文
posted @ 2017-03-30 00:04 kimsimple 阅读(223) 评论(0) 推荐(0)
摘要:全排列输入一个数n,按字典序输出1-n的全排列 阅读全文
posted @ 2017-03-11 11:11 kimsimple 阅读(428) 评论(0) 推荐(0)
摘要:#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)//深搜函数,参数为坐标(... 阅读全文
posted @ 2016-09-10 11:29 kimsimple 阅读(238) 评论(0) 推荐(0)