摘要: 分析:先用BFS或者bellman-ford求ET点到所有点的最短路径长度,然后穷举所有点假设被删除后,DFS一下看能否与ET点连通。 Code Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.C... 阅读全文
posted @ 2009-05-09 19:44 黄浩贤 阅读(262) 评论(0) 推荐(0) 编辑
摘要: 分析:不是难题,只是折磨人的题,还好要变通变通,运用STL容易解决。 Code Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->#includeios... 阅读全文
posted @ 2009-05-09 14:53 黄浩贤 阅读(301) 评论(0) 推荐(0) 编辑
摘要: 分析:也是经典的单源最短路径问题,算法有多种,我这里用Bellman-Ford主要是练练。 Code Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->... 阅读全文
posted @ 2009-05-09 14:51 黄浩贤 阅读(216) 评论(0) 推荐(0) 编辑
摘要: 分析:经典的传递闭包,用floyd-warshall算法,是O(n^3)。 for(int k = 1; k for(int i = 1; i for(int j = 1; j Code Code highlighting produced by Actipro CodeHighligh... 阅读全文
posted @ 2009-05-09 14:49 黄浩贤 阅读(197) 评论(0) 推荐(0) 编辑