随笔分类 -  搜索

摘要:BFS能解决的问题图论都能解决,但BFS能跑的图必须有每条边权值相同的特质。 电路维修 #include<queue> #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #define MAXN 105 阅读全文
posted @ 2020-10-23 19:43 林生。 阅读(177) 评论(0) 推荐(0)
摘要:折半搜索 假设每一位都要k种情况,则直接搜索的复杂度为$O(N$k\()\),折半搜索复杂度为$O(2*N$k/2\()\)。 #include<bits/stdc++.h> #define N 44 #define int long long using namespace std; int n, 阅读全文
posted @ 2020-10-23 19:39 林生。 阅读(115) 评论(0) 推荐(0)
摘要:搜索的本质是模拟。 ###P1092 虫食算 #include<bits/stdc++.h> using namespace std; const int N=30; string ss; int n,val[N],s[4][N]; bool use[N]; void dfs(int x,int y 阅读全文
posted @ 2020-10-23 17:38 林生。 阅读(113) 评论(0) 推荐(0)