
深搜和广搜
哆啦AC梦
软件工程
展开
-
POJ 3414 Pots
DescriptionYou are given two pots, having the volume of A and B liters respectively. The following operations can be performed:FILL(i) fill the pot i (1 ≤ i ≤ 2) from the tap;DROP(i)原创 2015-08-15 16:19:29 · 312 阅读 · 0 评论 -
POJ 1724 ROADS
题目链接:点击打开链接题目大意:有n个点,给你r条边,再给你k块钱,r行数据中每行4个整数S,D,L,T代表从S到D点的长度为L,需要花费为T,问你从1到n点在k块钱足够的情况下最短路长是多少?题目解析:简单的搜索,和POJ3411的做法差不多,记得如果当前状态已经大于答案了或者钱已经不够了就要及时return,没有必要再继续搜下去,然后就没啥啦。#include #include原创 2016-08-18 08:12:14 · 458 阅读 · 0 评论 -
POJ 3411 Paid Roads
题目链接:点击打开链接题目大意:每行给定五个整数ai, bi, ci, Pi, Ri,点的个数不超过10个意思是如果一个人要从a点到达b点,如果他之前经过了c点那么花费为p,否则花费为r。问他要从1到n点最少花费是多少?题目解析:由于数据中有可能存在重边,所以我们应该使用邻接表建图,前向星也可。然后把所有的边存好之后,就从1点开始搜了,需要注意的是有些点我们有可能去某一个往返一次会原创 2016-08-18 08:03:58 · 435 阅读 · 0 评论 -
POJ 1699 Best Sequence
题目链接:点击打开链接题目大意:给你不超过10个长度不超过20的字符串,如果某两个字符串的首尾相同或没有相同,都可以连接起来,例如TCGG和GGAT就可以连接为TCGGAT,问把给你的所有字符串都按照这种规则连接起来,最短长度是多少?题目解析:首先因为n和字符串长度都很小,我们可以直接模拟处理出每个字符串两两之间的可以合并的长度是多少,例如TCGG和GGAT的可合并的长度为2,那么给每个字原创 2016-08-18 07:54:14 · 576 阅读 · 0 评论 -
POJ3026-Borg Maze(广度优先搜索+最小生成树)
Borg MazeTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 12346 Accepted: 4046DescriptionThe Borg is an immensely powerful race of enhanced humanoids fro原创 2016-07-18 20:53:40 · 1464 阅读 · 1 评论 -
Children of the Candy Corn(简单深搜+简单广搜)
Children of the Candy CornTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 12524 Accepted: 5386DescriptionThe cornfield maze is a popular Halloween treat原创 2016-07-18 10:24:45 · 613 阅读 · 0 评论 -
HDU-1010-Tempter of the Bone(搜索奇偶剪枝)
HDU-1010-Tempter of the Bone(搜索奇偶剪枝)原创 2016-04-15 19:51:39 · 407 阅读 · 0 评论 -
POJ 2706 Connect
ConnectDescriptionFigure 1Figure 2Figure 3aFigure 3bFigure 4Your task is to decide if a specified sequence of moves in the board game Twixt ends with a winn原创 2016-01-22 20:51:42 · 648 阅读 · 0 评论 -
POJ 3083 Children of the Candy Corn
Children of the Candy CornDescriptionThe cornfield maze is a popular Halloween treat. Visitors are shown the entrance and must wander through the maze facing zombies, chainsaw-wielding psychopat原创 2015-08-04 09:09:43 · 371 阅读 · 0 评论 -
Codeforces 377 A. Maze(搜索技巧)
A. MazeTime Limit: 2000msMemory Limit: 262144KB64-bit integer IO format: %I64d Java class name: (Any)Submit StatusPavel loves grid mazes. A grid maze is an n × m rectang原创 2016-08-08 16:20:15 · 410 阅读 · 0 评论