![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
ACM广度优先搜素
桑榆207
在最终的结果到来之前,任何肯定会赢之类的话都是虚无缥缈的。
展开
-
广搜打印最短路径
打印最短路径: 在5个方格中找到两点之间最短距离的路径: #include<cstdio> #include<cstring> #include<queue> #include<algorithm> using namespace std; const int maxn=6; bool vst[maxn][maxn]; // 访问标记 int ...原创 2018-09-27 22:05:32 · 458 阅读 · 0 评论 -
bfs算法1.1(模板+剪枝)
给定一个迷宫,2代表起点,3代表终端,0不可走,1可走,若有最短距离输出起点到终点最短距离; #include<cstdio> #include<queue> #include<cstring> using namespace std; const int maxn=100+5; int dx[]={-1,1,0,0}; int dy[]={0,0,-1,1...原创 2018-10-13 22:01:05 · 223 阅读 · 0 评论 -
Bfs算法1.2
题目大意: 有一块地有一些石油。“@”代表着这是石油,“#”代表着这不是石油。若两块石油相邻,则认为他们是一块石油。请问这块地里一共有多少块石油? bfs做法: #include<bits/stdc++.h> using namespace std; const int maxn=100+5; int dx[]= {-1,1,0,0}; int dy[]= {0,0,-1,1}...原创 2018-10-13 22:23:43 · 419 阅读 · 0 评论 -
HDU5637 Transform 异或+BFS处理
http://acm.hdu.edu.cn/showproblem.php?pid=5637 A list of nn integers are given. For an integer xx you can do the following operations: + let the binary representation of xx be b31b30...b0¯¯¯¯¯¯¯¯¯¯¯...原创 2019-02-03 14:00:56 · 137 阅读 · 0 评论 -
51NOD--1489 蜥蜴和地下室--dfs
哈利喜欢玩角色扮演的电脑游戏《蜥蜴和地下室》。此时,他正在扮演一个魔术师。在最后一关,他必须和一排的弓箭手战斗。他唯一能消灭他们的办法是一个火球咒语。如果哈利用他的火球咒语攻击第i个弓箭手(他们从左到右标记),这个弓箭手会失去a点生命值。同时,这个咒语使与第i个弓箭手左右相邻的弓箭手(如果存在)分别失去b(1 ≤ b < a ≤ 10)点生命值。 因为两个端点的弓箭手(即标记为1和n的弓箭...原创 2019-04-13 09:57:16 · 108 阅读 · 0 评论 -
CF--C. Amr and Chemistry--位运算||BFS隐式图搜索(队列清空标记替代memset)
C. Amr and Chemistry time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Amr loves Chemistry, and specially doing experiments. He is p...原创 2019-08-30 14:35:03 · 138 阅读 · 0 评论