摘要: 题目链接:幸运数字Ⅱ 打表: #include<bits/stdc++.h> using namespace std; typedef long long ll; ll l,r,j,ans,pos; ll k[10005],g; void dfs(ll x) { if(x>4444444444) r 阅读全文
posted @ 2020-06-27 14:46 chstor 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 题目链接:走出迷宫 DFS解法: #include<bits/stdc++.h> using namespace std; const int maxn=510; int n,m,s1,s2,t1,t2; char mp[maxn][maxn]; int vis[maxn][maxn]; int d 阅读全文
posted @ 2020-06-27 11:21 chstor 阅读(206) 评论(0) 推荐(0) 编辑
摘要: 搜索 • 通过不停的试探去寻找解的一种算法。 • 与其说是一种算法,不如说是一种方法。 • 基础的方法有暴力的搜索法,深搜,广搜三种。 • 更高级的有IDDFS,DBFS,A*,IDA*等等 深度优先搜索(dfs) “一条道走到黑”“走不了了再倒回去” 算法过程: VOID DFS(状态 A) 1. 阅读全文
posted @ 2020-06-27 11:17 chstor 阅读(120) 评论(0) 推荐(0) 编辑
摘要: 老子的全排列呢 #include<bits/stdc++.h> using namespace std; int orders[10];//8个位置 int chosen[10];//标记 void dfs(int x){ if(x>=9){//如果超过8 for(int i=1;i<=8;i++) 阅读全文
posted @ 2020-06-27 11:09 chstor 阅读(284) 评论(0) 推荐(0) 编辑