常用算法(搜索) 二

一 poj上面的搜索题

最近一直在做搜索题,感觉好有意思
下面是自己找的poj上的搜索题,有重复,慢慢做着poj <wbr>搜索题,不断更新!

 

poj-1198 双向BFS

poj-1324 听说是很麻烦的BFS,也不是很麻烦

poj-1077 经典8数码,广搜(2XXMS),然后构造(0MS)

poj-3240 n数码,构造

poj-1190 深搜+剪枝 UVA跑了2S多

poj-3346 BFS,数据规模不大

poj-2046 BFS,注意状态的保存。

poj-3340 算是搜的吧

poj-3322 BFS,一次编译过掉,一次AC

poj-3328 BFS+优先队列

poj-2034 DFS

poj-1191 DFS

poj-3288 比赛居然会想到BFS

poj-1321 DFS

poj-3221 BFS

poj-3333         MS100个点,DFS不行,可是居然就是DFS过的,汗吧。。

poj-1252 小小的BFS下

poj-2922 二分+BFS或者DFS判断

poj-2920 BFS

poj-1465 BFS

poj-2631 DFS 2次就好了

poj - 3037 我是搜的,DP 也行

poj--3377 解题报告是o(n)的DP ,但是我BFS+优先队列过了,用dijkstra with heap也能过

poj-- 2449 第K短路,BFS A*

poj--2908 BFS+优先队列+HASH

1010 stamps
1011 sticks Accepted 2006-08-03 04:09
1020 Anniversary Cake
1022 Packing Unit 4D Cubes
1024 Tester Program
1054 The Troublesome Frog
1062 昂贵的聘礼
1069 The Bermuda Triangle
1072 Puzzle Out
1077 Eight Accepted 2006-08-19 16:16 A*,也可逆向搜索,预先算出所有状态
1084 Square Destroyer
1100 Dreisam Equations
1101 The Game (BFS) Accepted 2006-08-31 01:03简单题,非常普通的BFS
1110 Double Vision
1111 Image Perimeters Accepted 2006-08-14 23:22 Floodfill again!
1117 Pairs of Integers
1118 Lining Up
1128 Frame Stacking Accepted 2006-07-29
1129 Channel Allocation(图的最大独立集)
1137 The New Villa (BFS) Accepted 2006-08-29 23:07
1142 Smith Numbers
1162 Building with Blocks
1164 The castle (DFS)
1166 The Cocks Accepted 2006-07-31
1167 The buses
1176 Party Lamps Accepted 2006-08-02
1183 反正切函数的应用 Accepted 2006-08-30 22:27没劲~一道简单的数学推导题~
1184 聪明的打字员 Accepted 2006-08-17 06:18 如果觉得自己BFS的题做得差不多了,可以做一下这道题.作了这道题开始对BFS刮目相看了~花了整整一晚上写代码,改代码~
1190 生日蛋糕
1191 棋盘分割
1194 HIDDEN CODES 搜索+DP
1231 The Alphabet Game
1233 Street Crossing (BFS)
1248 Safecracker
1256 Anagram Accepted
1270 Following orders Accepted 2006-08-06 01:59 similar to toposort
1318 Word Amalgamation
1321 棋盘问题 Accepted 2006-08-06 02-55
1324 Holedox Moving (BFS)
1327 Moving Object Recognition Accepted 2006-08-22 01:11 Floodfill again
1338 Ugly Numbers
1363 Rails
1376 Robot Accepted 2006-08-13 06:52太阴险了,机器人起始位置和目的地可能重合,BFS
1416 Shredding Company Accepted
1465 Multiple Accepted 2006-08-05 15:21
1476 Always On the Run (BFS)
1480 Optimal Programs (BFS)
1482 It's not a Bug, It's a Feature! (BFS)
1543 Pefect Cubes Accepted 2006-08-06 03:45easy~无聊题~
1562 Oil Deposits Accepted 2006-08-14 04:39 Floodfill
1564 Sum It Up Accepted
1573 Robot Motion
1579 Fuction Run Fun
1601 Pizza Anyone?
1606 Jugs Accepted
1632 Vase collection
1639 Picnic Planing
1655 Balancing Act
1659 Frog's Neighborhood
1664 放苹果 Accepted 2006-08-06 04-15整数无序拆分
1680 Frok() Makes Trouble
1683 Puzzlestan
1691 Painting A Board
1708 Game
1709 Cross word
1713 Divide et unita
1714 The Cave
1731 orders Accepted 2006-08-06 05:07任意字符串的全排列
1742 Coins Accepted 2006-08-06 20:02
1745 Divisibility Accepted 2006-08-08 12:33shouldn't be counted as a searching prob
1746 Loan
1753 Flip Game (BFS) Accepted
1771 Elevator Stopping Plan
1775 Sum of Factorials Accepted
1826 The best Farm
1831 不定方程组
1847 Tram Accepted 2006-08-10 02:35 Dijkstra
1855 Mint
1856 Sea Battle
1873 The Fortified Forest 回溯
1878 Jill's Bike
1882 Stamps
1890 Switching Channels
1903 Jurassic Remains
1915 Knight Moves (BFS) Accepted 2006-08-10 15:08双向广度优先搜索提高效率
1924 The Treasure
1935 Journey
1948 Trianglar Pastures
1950 Dessert Accepted 2006-08-11 01:30痛苦的回忆……
1966 Cable TV Network
1979 Red and Black Accepted 2006-08-05 17:04
1980 Unit Fraction Partition 剪枝
2038 Team Ranking Accepted 2006-08-11 19:12无聊题,全排列加四层循环=0ms
2046 Gap
2049 Finding Nemo
2078 Matrix
2083 Fractal
2157 Maze
2170 Lattice Animals
2182 LOst cows Accepted 2006 08-13 17:02 segment tree
2184 Cow Exibition
2197 Jill's Tour Paths
2225 Asteriods! Accepted
2251 Dungeon Master Accepted 2006-08-21 02:39三维迷宫BFS,简单
2288 Islands and Bridges
2243 Knight Moves (BFS) Accepted
2312 Battle City (BFS) Accepted 2006-08-16 01:13一个int型数组定义为char而痛苦WA了半天。
2331 Water Pipe
2339 Rock, Scissors, Paper
2340 Memory management
2349 Aratic Network
2362 Square Accepted 2006-08-02
2378 Tree Cutting
2386 Lake Counting Accepted 2006-08-14 04:50 Floodfill
2415 Hike on a Gragh Accepted 2006-08-21 01:51普通BFS
2547 No Tipping Accepted 2006-08-21 18:55 DFS+DP状态压缩
2676 Sudoku
2908 Quantum Accepted 2006-09-09 20:10 BFS+优先队列


csdn上的

1010 stamps

1011 sticks Accepted 2006-08-03 04:09
1020 Anniversary Cake
1022 Packing Unit 4D Cubes
1024 Tester Program
1054 The Troublesome Frog
1062 昂贵的聘礼暂告一段落,先把DP题做一下,因为两者有很多交叉的地方,有很多题DP和搜索都可以,有些DFS的题需要状态压缩DP的慢慢做吧~~
搜索相关资料:点击进入
1010 stamps
1069 The Bermuda Triangle
1072 Puzzle Out
1077 Eight
Accepted 2006-08-19 16:16 A*,也可逆向搜索,预先算出所有状态
1084 Square Destroyer
1100 Dreisam Equations
1101 The Game (BFS) Accepted 2006-08-31 01:03简单题,非常普通的BFS
1110 Double Vision
1111 Image Perimeters Accepted 2006-08-14 23:22 Floodfill again!
1117 Pairs of Integers
1118 Lining Up
1128 Frame Stacking Accepted 2006-07-29
1129 Channel Allocation(图的最大独立集)
1137 The New Villa (BFS) Accepted 2006-08-29 23:07
1142 Smith Numbers
1162 Building with Blocks
1164 The castle (DFS)
1166 The Cocks Accepted 2006-07-31
1167 The buses
1176 Party Lamps Accepted 2006-08-02
1183 反正切函数的应用 Accepted 2006-08-30 22:27没劲~一道简单的数学推导题~
1184 聪明的打字员 Accepted 2006-08-17 06:18 如果觉得自己BFS的题做得差不多了,可以做一下这道题.作了这道题开始对BFS刮目相看了~花了整整一晚上写代码,改代码~
1190 生日蛋糕
1191 棋盘分割
1194 HIDDEN CODES 搜索+DP
1231 The Alphabet Game
1233 Street Crossing(BFS)
1248 Safecracker
1256 Anagram Accepted
1270 Following Orders Accepted 2006-08-06 01:59  similar to toposort
1318 Word Amalgamation
1321 棋盘问题 Accepted 2006-08-06 02-55
1324 Holedox Moving (BFS)
1327 Moving Object Recognition
Accepted 2006-08-22 01:11 Floodfill again
1338 Ugly Numbers
1363 Rails
1376 Robot
Accepted 2006-08-13 06:52 太阴险了,机器人起始位置和目的地可能重合,BFS
1416 Shredding Company Accepted
1465 Multiple Accepte d 2006-08-05 15:21
1476 Always On the Run (BFS)
1480 Optimal Programs (BFS)
1482 It's not a Bug, It's a Feature!(BFS)
1543 Pefect Cubes Accepted 2006-08-06 03:45easy~无聊题~
1562 Oil Deposits Accepted 2006-08-14 04:39 Floodfill
1564 Sum It Up Accepted
1573 Robot Motion
1579 Fuction Run Fun
1601 Pizza Anyone?
1606 Jugs Accepted
1632 Vase collection
1639 Picnic Planing
1655 Balancing Act
1659 Frog's Neighborhood
1664 放苹果 Accepted 2006-08-06 04-15整数无序拆分
1680 Frok() Makes Trouble
1683 Puzzlestan
1691 Painting A Board
1708 Game
1709 Cross word
1713 Divide et unita
1714 The Cave
1731 Orders Accepted 2006-08-06 05:07任意字符串的全排列
1742 Coins
Accepted 2006-08-06 20:02
1745 Divisibility Accepted 2006-08-08 12:33shouldn't be counted as a searching prob
1746 Loan
1753 Flip Game (BFS)Accepted
1771 Elevator Stopping Plan
1775 Sum of Factorials Accepted
1826 The best Farm
1831 不定方程组
1847 Tram Accepted 2006-08-10 02:35 Dijkstra
1855 Mint
1856 Sea Battle
1873 The Fortified Forest 回溯
1878 Jill's Bike
1882 Stamps
1890 Switching Channels
1903 Jurassic Remains
1915 Knight Moves (BFS) Accepted 2006-08-10 15:08双向广度优先搜索提高效率
1924 The Treasure
1935 Journey
1948 Trianglar Pastures
1950 Dessert Accepted 2006-08-11 01:30痛苦的回忆……
1966 Cable TV Network
1979 Red and Black Accepted 2006-08-05 17:04
1980 Unit Fraction Partition 剪枝
2038 Team Ranking Accepted 2006-08-11 19:12无聊题,全排列加四层循环=0ms
2046 Gap
2049 Finding Nemo
2078 Matrix
2083 Fractal
2157 Maze
2170 Lattice Animals
2182 LOst cows
Accepted 2006 08-13 17:02 segment tree
2184 Cow Exibition
2197 Jill's Tour Paths
2225 Asteriods!
Accepted
2251 Dungeon Master Accepted 2006-08-21 02:39三维迷宫BFS,简单
2288 Islands and Bridges
2243 Knight Moves (BFS)Accepted
2312 Battle City (BFS) Accepted 2006-08-16 01:13 一个int型数组定义为char而痛苦WA了半天。
2331 Water Pipe
2339 Rock, Scissors, Paper
2340 Memory management
2349 Aratic Network
2362 Square Accepted 2006-08-02
2378 Tree Cutting
2386 Lake Counting Accepted 2006-08-14 04:50 Floodfill
2415 Hike on a Gragh Accepted 2006-08-21 01:51普通BFS
2547 No Tipping Accepted 2006-08-21 18:55DFS+DP状态压缩
2676 Sudoku

2908 QuantumAccepted 2006-09-09 20:10 BFS+优先队列

以下转自http://jiyuede.blog.163.com/blog/static/3325192120102196151530/
格式说明:题目名后面列出个人此题的大致难度(对菜鸟而言)

POJ 1069 -The Bermuda Triangle(难)
http://acm.pku.edu.cn/JudgeOnline/problem?id=1069
题意:用给定三角型填充六边形
解法:此题的思想上精华在于坐标化
ps:传说中比较bt,确实比较bt,主要很容易写错,我ac了,但程序没完全对....

POJ 1077 - Eight(中等,此题不做人生不完整)
http://acm.pku.edu.cn/JudgeOnline/problem?id=1077
题意:八数码问题,超经典题
解法:广搜,A*,双向广搜
相关:http://hi.baidu.com/zfy0701/blog/item/7fcaba2c3d5425e98a1399cf.html
(百度之星的版本,强烈推荐):http://acm.hnu.cn:8080/on

line/?action=problem&type=show&id=10466&courseid=0

POJ 1084 - Square Destroyer(中等,经典题)
http://acm.pku.edu.cn/JudgeOnline/problem?id=1084
题意:把每个正方型看做集合中的元素,每个木棒看做是一个子集,求最小的子集覆盖
解法:dfs,A*,广搜肯定爆空间

POJ 1167 - The Buses(好难啊)
http://acm.pku.edu.cn/JudgeOnline/problem?id=1167
题意:这道题综合了很多经典的深搜技巧,狂顶
解法:dfs

POJ 1190 - 生日蛋糕(基础,好题)
http://acm.pku.edu.cn/JudgeOnline/problem?id=1190
题意:略
解法:dfs,题偏简单,但做出来还是有些感觉的

POJ 1324 - Holedox Moving(中等)
http://acm.pku.edu.cn/JudgeOnline/problem?id=1324
题意:略
解法:A*,dfs + 上界剪枝,广搜
相关:http://hi.baidu.com/zfy0701/blog/item/7fcaba2c3d5425e98a1399cf.html
http://hi.baidu.com/zfy0701/blog/item/a3c44ecc049b1c1501e92806.html

POJ 1376 - Robot(基础)
http://acm.pku.edu.cn/JudgeOnline/problem?id=1376
题意:略
解法:bfs,A*....

POJ 1475 - Pushing Boxes(中等,很推荐)
http://acm.pku.edu.cn/JudgeOnline/problem?id=1475
题意:推箱子游戏
解法:双重bfs(对箱子bfs 时 对人bfs),A*

POJ 1945 - Power Hungry Cows(??)
http://acm.pku.edu.cn/JudgeOnline/problem?id=1945
题意:略
解法:在一份解题报告中被列为难题,不过好好像写了个很简单很暴力的bfs就过了...速度还是有些慢,暂时想不到好的启发函数

POJ 2044 - Weather Forecast(中等)
http://acm.pku.edu.cn/JudgeOnline/problem?id=2044
题意:略
解法:广搜,dp,深搜
相关:http://hi.baidu.com/zfy0701/blog/item/d7b6490f847948e8ab6457c6.html

POJ 2286 - The Rotation Game(较难)
http://acm.pku.edu.cn/JudgeOnline/problem?id=2286
题意:略
解法:IDA*(迭代加深+上下界强剪
相关:http://hi.baidu.com/zfy0701/blog/item/ce0f802261bfbba14723e871.html

POJ 2308 - Dearboy's Puzzle(中等,但做的人少?)
http://acm.pku.edu.cn/JudgeOnline/problem?id=2308
题意:判断连连看是否有解
解法:DFS + BFS
相关:http://hi.baidu.com/zfy0701/blog/item/c62f41af65aa1fca7cd92afc.html

POJ 2426 Remainder(较难,=)
http://acm.pku.edu.cn/JudgeOnline/problem?id=2426
题意:略,主要是数论部分比较容易让人抓狂
解法:bfs
相关:http://hi.baidu.com/zfy0701/blog/item/7fcaba2c3d5425e98a1399cf.html

POJ 2449 Remmarguts' Date(中等,强烈推荐)
http://acm.pku.edu.cn/JudgeOnline/problem?id=2449
题意:经典问题:K短路
解法:dijkstra+A*,方法很多
相关:http://acm.pku.edu.cn/JudgeOnline/showcontest?contest_id=1144

POJ 2688 - Cleaning Robot(基础)
http://acm.pku.edu.cn/JudgeOnline/problem?id=2688
题意:bfs后转换为tsp问题
解法:bfs+dp,bfs+dfs
相关:http://hi.baidu.com/zfy0701/blog/item/ceb06f261749a6128a82a1b2.html

POJ 2908 - Quantum(中等)
http://acm.pku.edu.cn/JudgeOnline/problem?id=2908
题意:其实就是找单源最短路径
解法:优先队列广搜(即dijkstra),建议用位运算优化

POJ 3074 - Sudoku(中等)
http://acm.pku.edu.cn/JudgeOnline/problem?id=3074
题意:数独游戏,数据比2676强很多,但比3076弱
解法:用dfs回溯基本可过,不过每次应选择可能填的数字最少的格子搜
更快的方法是先转换成exact cover问题,然后用经典dancing links解决,
dancing links原始论文:http://lanl.arxiv.org/PS_cache/cs/pdf/0011/0011047v1.pdf
翻译:http://sqybi.com/works/dlxcn/

POJ 3322 - Bloxorz I(基础)
http://acm.pku.edu.cn/JudgeOnline/problem?id=3322
题意:略,这个游戏本身很好玩(http://jandan.net/2008/01/24/bloxorz.html)
解法:广搜,双向广搜
相关:http://hi.baidu.com/zfy0701/blog/item/d7b6490f847948e8ab6457c6.html

POJ 3460 - Booksort(较难,很推荐)
http://acm.pku.edu.cn/JudgeOnline/problem?id=3460
题意:略
解法:IDA*,A*,DFS*
相关:http://hi.baidu.com/zfy0701/blog/item/5c5a404b0f73ecf582025ce4.html

POJ 3523 - The Morning after Halloween(较难)
http://acm.pku.edu.cn/JudgeOnline/problem?id=3523
题意:把所有机器人移到各自的位置,不能相撞或重合
解法:我的状态设计太暴力了:以所有机器人位置表示状态。然后用A*过,排倒数第几,郁闷。谁知道好的状态设计方法告诉我^_^

POJ 3633 - Copying DNA(较难)
http://acm.pku.edu.cn/JudgeOnline/problem?id=3633
题意:一个填充字符串的搜索题
解法:各种搜法皆宜
相关:算法的实现较挑战,我是参考了 http://www.wiskey86.cn/wordpress/?p=54 才搞定的

POJ 3635 full tank?(中等)
http://acm.pku.edu.cn/JudgeOnline/problem?id=3635
题意:最短路变形
解法:广搜
相关: http://hi.baidu.com/hnu_reason/blog/item/086e3dccfc8cb21600e9286b.html


你可能感兴趣的:(acm,c++,c++,acm)