摘要:
题目大意是找出一个人作为源点,使得从这个人开始散播信息到全部人都得到信息所用时间最少,输出这个人的号码跟最少时间。算是一道典型的最短路的题目,用floyd算法即可解决。AC code: 1 #include <iostream> 2 #define MAX 101 3 #define INF 1000000 4 using namespace std; 5 int dist[MAX][MAX]; 6 int map[MAX][MAX]; 7 int n; 8 int contact; 9 void input()10 {11 int i, j;12 int id, time;1.. 阅读全文
posted @ 2012-02-27 23:30
背着超人飞
阅读(161)
评论(0)
推荐(0)
摘要:
这一题跟POJ的heavy transportation 一题正好相反,是求最短路中的边权最长边。用的dijsktra算法,用邻接表存储各边权。AC code: 1 #include <iostream> 2 #include <cmath> 3 #include <string.h> 4 #define MAX 1000 5 #define MAXN 100000 6 using namespace std; 7 8 int tmap[MAX][2]; 9 float map[MAX][MAX];10 float dis[MAX];11 bool vis[ 阅读全文
posted @ 2012-02-27 21:10
背着超人飞
阅读(175)
评论(0)
推荐(0)