2013年1月30日

最短路算法的整理

摘要: Floyd-Warshall算法 for (int k=1;k<=n;k++) { for (int i=1;i<=n;i++) { for (int j=1;j<=n;j++) { if (a[i][k]+a[k][j]<a[i][j]) { a[i][j]=a[i][k]+a[k][j]; ... 阅读全文

posted @ 2013-01-30 21:53 电子幼体 阅读(115) 评论(0) 推荐(0) 编辑

POJ 1125 Stockbroker Grapevine

摘要: Stockbroker GrapevineTime Limit:1000MSMemory Limit:10000KTotal Submissions:22127Accepted:12069DescriptionStockbrokers are known to overreact to rumours. You have been contracted to develop a method of spreading disinformation amongst the stockbrokers to give your employer the tactical edge in the st 阅读全文

posted @ 2013-01-30 21:48 电子幼体 阅读(125) 评论(0) 推荐(0) 编辑

POJ 2253 Frogger

摘要: FroggerTime Limit:1000MSMemory Limit:65536KTotal Submissions:19130Accepted:6222DescriptionFreddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on another stone. He plans to visit her, but since the water is dirty and full of tourists' sunscreen 阅读全文

posted @ 2013-01-30 16:26 电子幼体 阅读(123) 评论(0) 推荐(0) 编辑

POJ 3258 Wormholes解题报告

摘要: WormholesTime Limit:2000MSMemory Limit:65536KTotal Submissions:22311Accepted:7958DescriptionWhile exploring his many farms, Farmer John has discovered a number of amazing wormholes. A wormhole is very peculiar because it is a one-way path that delivers you to its destination at a time that is BEFORE 阅读全文

posted @ 2013-01-30 11:55 电子幼体 阅读(135) 评论(0) 推荐(0) 编辑

Bellman-Ford算法

摘要: 贝尔曼-福特算法(Bellman-Ford)是由RichardBellman和Lester Ford创立的,求解单源最短路径问题的一种算法。有时候这种算法也被称为Moore-Bellman-Ford 算法,因为Edward F. Moore也为这个算法的发展做出了贡献。它的原理是对图进行V-1次松弛操作,得到所有可能的最短路径。其优于迪科斯彻算法的方面是边的权值可以为负数、实现简单,缺点是时间复杂度过高,高达O(VE)。但算法可以进行若干种优化,提高了效率。自然语言描述对有向图G(V,E),用贝尔曼-福特算法求以Vs为源点的最短路径的过程:建立dist[],表示目前已知源点到各个节点的最短距离 阅读全文

posted @ 2013-01-30 11:30 电子幼体 阅读(241) 评论(0) 推荐(0) 编辑

二分图最大匹配--匈牙利算法

摘要: 二分图的基本概念一个无向图G=<V, E>,如果存在两个集合X、Y,使得X∪Y=V, X∩Y=Φ,并且每一条边e={x,y}有x∈X,y∈Y,则称G为一个二分图(bipartite graph)。常用<X, E, Y>来表示一个二分图。若对X中任一x及Y中任一y恰有一边e∈E,使e = {x, y}, 则称G为完全二分图(complete bipartite graph)。当|X| = m,|Y| = n时,完全二分图G记为Km,n。二分图的性质:定理:无向图G为二分图的充分必要条件是,G至少有两个顶点,且其所有回路的长度均为偶数。匹配:设G=<V, E>为 阅读全文

posted @ 2013-01-30 10:18 电子幼体 阅读(166) 评论(0) 推荐(0) 编辑

各大OJ题目分类

摘要: -----------------------------最优化问题-----------------------------------------------------------常规动态规划 SOJ1162 I-Keyboard SOJ2096 Maximum Submatrix SOJ2111 littleken bgSOJ2142 Cow Exhibition SOJ2505 The County FairSOJ2818 QQ音速 SOJ2469 Exploring Pyramids SOJ1833 Base Numbers SOJ2009 Zeros and Ones SOJ20 阅读全文

posted @ 2013-01-30 10:12 电子幼体 阅读(380) 评论(0) 推荐(0) 编辑

[置顶] ACM训练方案

摘要: 初期:一.基本算法:(1)枚举. (poj1753,poj2965)(2)贪心(poj1328,poj2109,poj2586)(3)递归和分治法.(4)递推.(5)构造法.(poj3295)(6)模拟法.(poj1068,poj2632,poj1573,poj2993,poj2996)二.图算法:(1)图的深度优先遍历和广度优先遍历.(2)最短路径算法(dijkstra,bellman-ford,floyd,heap+dijkstra) (poj1860,poj3259,poj1062,poj2253,poj1125,poj2240)(3)最小生成树算法(prim,kruskal) (poj 阅读全文

posted @ 2013-01-30 10:10 电子幼体 阅读(181) 评论(0) 推荐(0) 编辑

ACM训练方案

摘要: 初期:一.基本算法:(1)枚举. (poj1753,poj2965)(2)贪心(poj1328,poj2109,poj2586)(3)递归和分治法.(4)递推.(5)构造法.(poj3295)(6)模拟法.(poj1068,poj2632,poj1573,poj2993,poj2996)二.图算法:(1)图的深度优先遍历和广度优先遍历.(2)最短路径算法(dijkstra,bellman-ford,floyd,heap+dijkstra) (poj1860,poj3259,poj1062,poj2253,poj1125,poj2240)(3)最小生成树算法(prim,kruskal) (poj 阅读全文

posted @ 2013-01-30 10:10 电子幼体 阅读(148) 评论(0) 推荐(0) 编辑

Lizards and Basements 2 解题报告

摘要: DescriptionThis is simplified versionof the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced.Polycarp likes to play computer role-playing game «Lizards and Basements». At the moment he is playi 阅读全文

posted @ 2013-01-30 10:07 电子幼体 阅读(245) 评论(0) 推荐(0) 编辑

导航