
搜索算法
星染*
“万事胜意,未来可期”
展开
-
P1036 [NOIP2002 普及组] 选数——洛谷
P1036 [NOIP2002 普及组] 选数 - 洛谷 | 计算机科学教育新生态 (luogu.com.cn) //不要着急,耐心一点,相信自己,不要摆烂,一定要坚持 #include <bits/stdc++.h> using namespace std; typedef long long ll; map<int,int>dp; int a[10000],b[10000]; int n,k,ans=0; int su(int n){ int c=1; if(n==...原创 2022-05-03 17:08:16 · 456 阅读 · 2 评论 -
小红的rpg游戏———牛客(广搜)
坑点:注意用vis数组标记走过的路时,要用三维数组(不仅要标记走过的路,还要标记血量) 原因:可能直接走这一格要直接死,但是绕一下再走这一格就不会死,不能直接这个格子走过了就不走了,判定该格子走没走过还要判断血量 #include <bits/stdc++.h> using namespace std; const int N=100; char c[N][N]; int n,m,ans; int vis[N][N][N]; int dis[4][2]={{-1,0},{1,0...原创 2022-04-30 13:55:45 · 1997 阅读 · 1 评论 -
【无标题】
1002-走出迷宫_2021秋季算法入门班第六章习题:搜索与搜索剪枝 (nowcoder.com) 1.用结构体存储信息 #include <bits/stdc++.h> using namespace std; int n,m; char c[100][100]; int vis[100][100]; int dis[4][2]={{1,0},{-1,0},{0,1},{0,-1}}; struct node{ int x; int y; }; bool inline c原创 2022-02-27 17:32:05 · 313 阅读 · 0 评论