随笔分类 - 搜索
摘要:BFS能解决的问题图论都能解决,但BFS能跑的图必须有每条边权值相同的特质。 电路维修 #include<queue> #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #define MAXN 105
阅读全文
摘要:折半搜索 假设每一位都要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,
阅读全文
摘要:搜索的本质是模拟。 ###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
阅读全文

浙公网安备 33010602011771号