摘要: Problem - 1312 (hdu.edu.cn) BFS模板题 #include<iostream> #include<queue> using namespace std; typedef long long ll; const int INF=0x3f3f3f3f; int wx,hy,n 阅读全文
posted @ 2024-02-03 18:07 ACCbulb 阅读(20) 评论(0) 推荐(0)
摘要: Problem - 4460 (hdu.edu.cn) 写完提交答案错了,后面发现vis初始化的地方错了,以前BFS都只调用一次,看来我中毒太深。这个题更能体现BFS的特性,增加dis数组记录距离。 #include<iostream> #include<queue> #include<cstrin 阅读全文
posted @ 2024-02-03 18:00 ACCbulb 阅读(21) 评论(0) 推荐(0)
摘要: Problem - 1240 (hdu.edu.cn) 三维的BFS,存在一个坐标点的变换,即输入的是 (y , z , x),进行转换即可 #include<iostream> #include<queue> #include<cstring> using namespace std; int n 阅读全文
posted @ 2024-02-03 16:22 ACCbulb 阅读(22) 评论(0) 推荐(0)
摘要: 3414 -- Pots (poj.org) 这道题需要输出最后结果的执行过程,可以通过结构体,在结构体中定义一个数组s,s中存储了每一步的执行过程,实现了回溯。并且在运行中可以适当剪枝,减少枚举次数。 #include<iostream> #include<queue> #include<cstr 阅读全文
posted @ 2024-02-03 14:35 ACCbulb 阅读(25) 评论(0) 推荐(0)