随笔分类 -  算法:搜索

【洛谷P1378】油滴扩展
摘要:搜索…… PS一个坑点:r<=0时并不是舍弃这种情况,而是让r=0 (因为每个点都要放一滴油)(读题啊!) 1 #include<cstdio> 2 #include<cstring> 3 #include<cmath> 4 #define dd double 5 using namespace s 阅读全文
posted @ 2016-11-09 15:57 Absolutezero 阅读(170) 评论(0) 推荐(0)
【洛谷P2296】寻找道路
摘要:反正图两边bfs 1 #include<iostream> 2 #include<cstdio> 3 #include<queue> 4 5 using namespace std; 6 7 inline int readint(){ 8 int x=0,f=1; 9 char ch=getchar 阅读全文
posted @ 2016-10-31 18:49 Absolutezero 阅读(291) 评论(0) 推荐(0)
【BZOJ1085】骑士精神
摘要:迭代加深搜索。 剪枝:当满足以下任意一个条件退出: 1.当前已搜到答案时(ans!=-1||sum==0) 2.剩余步数+1<当前局面与目标局面不同的格子数sum 时(因为n步最多改变n+1个格子) 3.当前步数>当前规定最大步数时 1 #include<cstdio> 2 #include<cst 阅读全文
posted @ 2016-09-02 16:21 Absolutezero 阅读(119) 评论(0) 推荐(0)