书山有径勤为路>>>>>>>>

<<<<<<<<学海无涯苦作舟!

随笔分类 -  C Floyd

更加深入的了解Floyd
摘要:下面来看一道简单的但是有点意思的最短路径的问题。本次用的解法是Floyd.题目:http://acm.swust.edu.cn/oj/problem/0819/在使用Floyd的时候有三点需要注意:一:map[][]数组的初始化 这个是十分的重要的,不然无法Floyd。具体点就是,map[i][i]=0; map[i][j]=INF;二、输入时候的选择性 只有做到这一步,才能保证是最短的,不然不行。具体点就是,if(map[u][v] > w) map[u][v] = map[v][u] = w; 这个主要用在题目中没有说明是否会多次输入同一条边的时候。三、只有一个结点的情况 毫无... 阅读全文

posted @ 2011-11-26 10:46 More study needed. 阅读(252) 评论(0) 推荐(0) 编辑

Floyd算法解决 Jump
摘要:DescriptionThere is n pillar, their heights are (A1,A2,A3,…An).you can jump at the top of the pillars. But you will lose abs(a[j]-a[i])*abs(j-i) power when you jump from i-th pillar to j-th pillar. At first you have m power. Can you jump from s-th pillar to e-th pillar.InputThe input consists of sev 阅读全文

posted @ 2011-10-18 11:03 More study needed. 阅读(271) 评论(0) 推荐(0) 编辑

Floyd算法解决POJ 2263
摘要:DescriptionBig Johnsson Trucks Inc. is a company specialized in manufacturing big trucks. Their latest model, the Godzilla V12, is so big that the amount of cargo you can transport with it is never limited by the truck itself. It is only limited by the weight restrictions that apply for the roads al 阅读全文

posted @ 2011-10-04 11:52 More study needed. 阅读(383) 评论(0) 推荐(0) 编辑

Floyd算法解决POJ 1603
摘要:DescriptionRisk is a board game in which several opposing players attempt to conquer the world. The gameboard consists of a world map broken up into hypothetical countries. During a player's turn, armies stationed in one country are only allowed to attack only countries with which they share a c 阅读全文

posted @ 2011-10-03 19:42 More study needed. 阅读(542) 评论(0) 推荐(0) 编辑

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

导航

统计

书山有径勤为路>>>>>>>>

<<<<<<<<学海无涯苦作舟!

点击右上角即可分享
微信分享提示