随笔分类 -  图论

上一页 1 2

POJ 1860 Currency Exchange(BellmanFord算法的变形,求正环)
摘要:/*POJ 1860有多种汇币,汇币之间可以交换,这需要手续费,当你用100A币交换B币时,A到B的汇率是29.75,手续费是0.39,那么你可以得到(100 - 0.39) * 29.75 = 2963.3975 B币。问s币的金额经过交换最终得到的s币金额数能否增加货币的交换是可以重复多次的,所以我们需要找出是否存在正权回路,且最后得到的s金额是增加的怎么找正权回路呢?(正权回路:在这一回路上,顶点的权值能不断增加即能一直进行松弛)关键在于反向利用Bellman-Ford算法单源最短路径算法,因为题目可能存在负边,所以用Bellman Ford算法,原始Bellman Ford可以用来求负 阅读全文

posted @ 2012-08-17 23:06 kuangbin 阅读(3512) 评论(0) 推荐(1)

POJ 3159 Candies(差分规划+SPFA)
摘要:CandiesTime Limit: 1500MSMemory Limit: 131072KTotal Submissions: 18737Accepted: 4930DescriptionDuring the kindergarten days, flymouse was the monitor of his class. Occasionally the head-teacher brought the kids of flymouse’s class a large bag of candies and had flymouse distribute them. All the kids 阅读全文

posted @ 2012-08-17 21:31 kuangbin 阅读(3901) 评论(0) 推荐(1)

HDU 4370 0 or 1(最短路)
摘要:0 or 1Time Limit: 4000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 692Accepted Submission(s): 185Problem DescriptionGiven a n*n matrix Cij (1<=i,j<=n),We want to find a n*n matrix Xij (1<=i,j<=n),which is 0 or 1.Besides,Xij meets the following condi 阅读全文

posted @ 2012-08-17 19:20 kuangbin 阅读(3073) 评论(0) 推荐(1)

POJ 2513 Colored Sticks(欧拉回路,字典树,并查集)
摘要:Colored SticksTime Limit: 5000MSMemory Limit: 128000KTotal Submissions: 24748Accepted: 6519DescriptionYou are given a bunch of wooden sticks. Each endpoint of each stick is colored with some color. Is it possible to align the sticks in a straight line such that the colors of the endpoints that touch 阅读全文

posted @ 2012-08-07 10:18 kuangbin 阅读(2439) 评论(2) 推荐(0)

上一页 1 2

导航

JAVASCRIPT: