BFS
文章平均质量分 65
你的微笑依然那样灿烂
这个作者很懒,什么都没留下…
展开
-
LightOJ1066
//// main.cpp// dfs-bfs搜索//// Created by liuzhe on 16/8/10.// Copyright © 2016年 my_code. All rights reserved.//#include #include #include #include #include using namespace std;char原创 2017-02-18 21:37:09 · 368 阅读 · 0 评论 -
hdu 4462 - Scaring the Birds(状态压缩+bfs)
It’s harvest season now! Farmer John plants a lot of corn. There are many birds living around his corn field. These birds keep stealing his corn all the time. John can't stand with that any more. He原创 2017-09-23 20:06:14 · 321 阅读 · 0 评论 -
2017多校联合第十场/HDU 6171 Admiral 双向bfs + 哈希
AdmiralTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 153428/153428 K (Java/Others)Total Submission(s): 334 Accepted Submission(s): 105Problem DescriptionSuppose that you a原创 2017-08-25 15:37:16 · 702 阅读 · 1 评论 -
hdu 4771Stealing Harry Potter's Precious(状态压缩bfs)
Stealing Harry Potter's PreciousTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4067 Accepted Submission(s): 1756Problem Descript原创 2017-08-13 18:13:38 · 332 阅读 · 0 评论 -
poj 2251Dungeon Master(三维bfs)
Dungeon MasterTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 36467 Accepted: 13904DescriptionYou are trapped in a 3D dungeon and need to find the quick原创 2017-08-05 10:57:58 · 335 阅读 · 0 评论 -
hdu 4308 Saving Princess claire_(BFS+优先队列)
Saving Princess claire_Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2771 Accepted Submission(s): 1002Problem DescriptionPr原创 2017-03-07 20:15:00 · 380 阅读 · 0 评论 -
Gym 101196D Lost in Translation(BFS)
Problem D Lost in Translation题意: 给出一个图,从顶点开始(English),寻找 到每个点优先满足路径最短时的最小花费。思路: 所谓路径最短优先,其实就是 bfs 逐层搜索。若同层中有指向同一节点但花费不同的边,取最小即可。每搜完一层统计一遍 ans,给搜到的点打上 vis 标记即可。代码:原创 2017-03-27 19:43:38 · 503 阅读 · 0 评论 -
hdu 5025Saving Tang Monk(BFS)
点击打开链接题意:从K走到T,S为怪,走的时候就多花费一秒,走到T时收集m把不同的钥匙,但是规定收集n之前,必须1~n-1全部收集完毕,怪最多有5个思路:怪最多就有5个,然后钥匙是1~9把,我们每个点的状态就不会很多,在BFS时每个点的状态进行标记就行了,5个怪状态压缩着判断,因为这个怪在第二次经过的时候已经死了,不用花费时间去杀死它//// main.cp原创 2017-03-06 17:58:38 · 276 阅读 · 0 评论 -
BFS模板
#include #include #include using namespace std; struct node { int x,y,step; }; char map[105][105]; int vis[105][105]; int to[4][2]= {1,0,-1,0,0,1,0,-1}; int n,m,sx,s原创 2017-02-22 14:37:25 · 259 阅读 · 0 评论 -
POJ - 3278 Catch That Cow (BFS)
在很久很久以前,有一位大师级程序员,实力高强,深不可测,代码能力无人能及。从来没有人听说过他的真名,只知道他在完成一段代码后,总会跟上一行注释“十四出品,必属精品”,于是他在编程江湖上便有了绰号“十四”。 然而,十四大师并不满足于现有的一切,他想要让自己的实力有更进一步的提升。为此,他专程前往二次元世界修行。 二次元旅程归来的十四大师学习了新的技能——闪现。 在一条既定的直线道路原创 2017-10-14 22:10:56 · 424 阅读 · 0 评论