
搜索
文章平均质量分 78
bestsort
这个作者很懒,什么都没留下…
展开
-
hdu1016 Prime Ring Problem 深搜dfs
Prime Ring ProblemTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 58187 Accepted Submission(s): 25285Problem DescriptionA ring is compose of ...原创 2018-02-02 15:28:16 · 319 阅读 · 0 评论 -
第k短路 算法详解(图解)与模板(A* 算法)
A*是一种启发式搜索,根据目标地点和当前点的距离和估计要走的步数来决策下一步走哪个方向。而这两个参数,一般用g(x)g(x)和h(x)h(x),其中g(x)g(x)为xx点到目标点的实际距离。 所以最终的我们要走哪个点取决于g(x)+h(x)g(x)+h(x),取可选点中g(x)+h(x)g(x)+h(x)最优的那个点走。 而k短路,就是终点第K次被找到的时候。原创 2018-10-16 18:06:41 · 4788 阅读 · 0 评论 -
USACO2.3.5 Controlling Companies 控制公司(dfs)
Description 有些公司是其他公司的部分拥有者,因为他们获得了其他公司发行的股票的一部分。例如,福特公司拥有马自达公司12%的股票。据说,如果至少满足了以下条件之一,公司A就可以控制公司B了: 公司A = 公司B。 公司A拥有大于50%的公司B的股票。 公司A控制K(K >= 1)个公司,记为C1, …, CK,每个公司Ci拥有xi%的公司B的股票,并且x1+ … + xK >...原创 2018-09-26 12:21:14 · 544 阅读 · 0 评论 -
USACO1.5.4 Checker Challenge跳棋的挑战 解题报告(N皇后 回溯法)
Description 检查一个如下的6 x 6的跳棋棋盘,有六个棋子被放置在棋盘上,使得每行,每列,每条对角线(包括两条主对角线的所有对角线)上都至多有一个棋子。 列号 0 1 2 3 4 5 6 ------------------------- 1 | | O | | | | | ------------------------- 2...原创 2018-09-14 20:24:43 · 763 阅读 · 1 评论 -
USACO1.4.4 Mother's Mil 母亲的牛奶 题解报告(dfs)
题目描述 农民约翰有三个容量分别是A,B,C升的桶,A,B,C分别是三个从1到20的整数,最初,A和B桶都是空的,而C桶是装满牛奶的。有时,约翰把牛奶从一个桶倒到另一个桶中,直到被灌桶装满或原桶空了。当然每一次灌注都是完全的。由于节约,牛奶不会有丢失。 写一个程序去帮助约翰找出当A桶是空的时候,C桶中牛奶所剩量的所有可能性。 Input 单独的一行包括三个整数A,B和C。 Output ...原创 2018-09-06 09:17:08 · 421 阅读 · 0 评论 -
poj3126 Prime Path bfs 广搜入门
Prime PathTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 25156 Accepted: 13862DescriptionThe ministers of the cabinet were quite upset by the message from the Chief of Security stating that...原创 2018-03-28 17:03:52 · 281 阅读 · 0 评论 -
poj3278 Catch That Cow 一维广搜 bfs入门
Catch That CowTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 107515 Accepted: 33598DescriptionFarmer John has been informed of the location of a fugitive cow and wants to catch her immediat...原创 2018-03-27 20:00:33 · 250 阅读 · 0 评论 -
poj2251 Dungeon Master (三维迷宫) bfs广搜 简单题
Dungeon MasterTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 42890 Accepted: 16229DescriptionYou are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed o...原创 2018-03-27 19:51:32 · 422 阅读 · 0 评论 -
hdu1241 Oil Deposits dfs深搜水题
Oil DepositsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 36869 Accepted Submission(s): 21364Problem DescriptionThe GeoSurvComp geologic su...原创 2018-02-02 11:54:36 · 463 阅读 · 0 评论 -
poj3984 迷宫问题 bfs 最短路 广搜
迷宫问题Time Limit: 1000MS Memory Limit: 65536KTotal Submissions: 27913 Accepted: 16091Description定义一个二维数组: int maze[5][5] = { 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0...原创 2018-02-06 20:26:57 · 431 阅读 · 0 评论 -
Codeforces 1070A Find a Number(BFS) 2018-2019 ICPC, NEERC, Southern Subregional Contest Problem A
Description You are given two positive integers ddd and sss. Find minimal positive integer nnn which is divisible by ddd and has sum of digits equal to sss. Input The first line contains two positive ...原创 2018-10-25 17:20:40 · 526 阅读 · 0 评论