随笔分类 -  图-BFS

摘要:A. Packets A. Packets You have nn coins, each of the same value of 11. Distribute them into packets such that any amount xx (1≤x≤n1≤x≤n) can be formed 阅读全文
posted @ 2018-09-04 21:11 starry_sky 阅读(199) 评论(0) 推荐(0)
摘要:C. Nephren gives a riddle What are you doing at the end of the world? Are you busy? Will you save us? Nephren is playing a game with little leprechaun 阅读全文
posted @ 2017-12-11 20:03 starry_sky 阅读(249) 评论(0) 推荐(0)
摘要:E. Maximum Subsequence You are given an array a consisting of n integers, and additionally an integer m. You have to choose some sequence of indices b 阅读全文
posted @ 2017-11-11 16:51 starry_sky 阅读(221) 评论(0) 推荐(0)
摘要:微软大楼的设计方案 近日,微软新大楼的设计方案正在广泛征集中,其中一种方案格外引人注目。在这个方案中,大楼由 n 栋楼组成,这些楼从左至右连成一排,编号依次为 1 到 n,其中第 i 栋楼有 h_i​​ 层。每栋楼的每一层为一个独立的 办公区域,可以步行 直达同层相邻楼栋的办公区域,以及 直达同楼栋 阅读全文
posted @ 2017-06-04 21:31 starry_sky 阅读(620) 评论(0) 推荐(0)
摘要:bfs(宽度优先搜索),目的是系统地展开并检查图中的所有节点,以找寻结果。换句话说,它并不考虑结果的可能位置,彻底地搜索整张图,直到找到结果为止。 下面给出几个例子。 一维的例子: Catch That Cow Farmer John has been informed of the locatio 阅读全文
posted @ 2017-04-09 18:39 starry_sky 阅读(358) 评论(0) 推荐(0)
摘要:题目链接http://qscoj.cn/problem/37/ 标准的bfs模型,就直接贴代码了。 阅读全文
posted @ 2017-04-04 17:40 starry_sky 阅读(164) 评论(0) 推荐(0)