- 博客(14)
- 资源 (1)
- 收藏
- 关注
转载 【算法入门】广度/宽度优先搜索(BFS)
广度/宽度优先搜索(BFS) 【算法入门】 郭志伟@SYSU:raphealguo(at)qq.com 2012/04/27 1.前言 广度优先搜索(也称宽度优先搜索,缩写BFS,以下采用广度来描述)是连通图的一种遍历策略。因为它的思想是从一个顶点V0开始,辐射状地优先遍历其周围较广的区域,故得名。 一般可以用它做什么呢?一个最直观经典的例子就是走迷宫,我们从
2013-08-30 16:55:12 994
转载 【算法入门】深度优先搜索(DFS)
深度优先搜索(DFS) 【算法入门】 郭志伟@SYSU:raphealguo(at)qq.com 2012/05/12 1.前言 深度优先搜索(缩写DFS)有点类似广度优先搜索,也是对一个连通图进行遍历的算法。它的思想是从一个顶点V0开始,沿着一条路一直走到底,如果发现不能到达目标解,那就返回到上一个节点,然后从另一条路开始走到底,这种尽量往深处走的概念即是深度优先的
2013-08-30 16:48:52 1008 1
原创 POJ 一 1321 棋盘问题
棋盘问题 Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 19223 Accepted: 9588 Description 在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解
2013-08-30 16:39:21 680
原创 POJ 一 3009 Curling 2.0(DFS)
Curling 2.0 Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 8859 Accepted: 3736 Description On Planet MM-21, after their Olympic games this year, curling i
2013-08-30 14:24:22 646
原创 POJ 一 2488 A Knight's Journey(DFS)
A Knight's Journey Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 26133 Accepted: 8923 Description Background The knight is getting bored of seeing th
2013-08-30 10:36:28 487
原创 最小生成树PRIM()算法框架
#include #include #define max 2005 #define INF 0xfffff int map[max][max];//节点i,j之间的距离即为map[i][j],map[j][i]; int dis[max];//用来判断当前节点是否为生成树上节点 int ans,n;//ans表示生成树上的权重之和 void prim(); int min(int a,
2013-08-27 11:00:14 1293
原创 POJ 一 2485 Highways(最小生成树)
Highways Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 19029 Accepted: 8829 Description The island nation of Flatopia is perfectly flat. Unfortunately, F
2013-08-27 10:47:10 661
原创 POJ 一 1789 Truck History(最小生成树)
Truck History Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 15259 Accepted: 5851 Description Advanced Cargo Movement, Ltd. uses trucks of different types
2013-08-26 21:50:19 514
原创 POJ 一 1002 487-3279
487-3279 Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 220227 Accepted: 38384 Description Businesses like to have memorable telephone numbers. One way to
2013-08-26 11:14:29 608
原创 POJ 一 1016 Numbers That Count
Numbers That Count Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 17897 Accepted: 5932 Description "Kronecker's Knumbers" is a little company that manufac
2013-08-24 16:56:27 600
原创 POJ 一 2371 Questions and answers
Description The database of the Pentagon contains a top-secret information. We don't know what the information is — you know, it's top-secret, — but we know the format of its representation. It is
2013-08-22 18:22:31 628
原创 POJ 一 2388 Who's in the Middle
Description FJ is surveying his herd to find the most average cow. He wants to know how much milk this 'median' cow gives: half of the cows give as much or more than the median; half give as much o
2013-08-22 16:52:41 1190
原创 POJ 一 1035 Spell checker
Description You, as a member of a development team for a new spell checking program, are to write a module that will check the correctness of given words using a known dictionary of all correct wor
2013-08-20 22:39:50 1069
原创 POJ 一 1007 DNA Sorting
Description One measure of ``unsortedness'' in a sequence is the number of pairs of entries that are out of order with respect to each other. For instance, in the letter sequence ``DAABEC'', this m
2013-08-20 22:19:36 470
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人