随笔分类 -  最短路径

【解题报告】【HDOJ2544】【Bellman-Ford最短路】最短路
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2544 1 #include<stdio.h> 2 #include<string.h> 3 #define INF 0x3f3f3f3f 4 struct node{ 5 int u; 6 int v; 7 int weight; 8 }; 9 struct node map[10001];10 int record[101];11 int n,m;12 13 void Bellman_init()14 {15 int i;16 for(i=0;i<2*m;... 阅读全文

posted @ 2012-07-21 18:27 coding封神 阅读(114) 评论(0) 推荐(0)

【解题报告】【HDOJ2544】【Dijkstra最短路】最短路
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2544 1 #include<stdio.h> 2 #include<string.h> 3 #define INF 0x3f3f3f3f 4 #define min(a,b) (a>b?b:a) 5 6 int map[101][101]; 7 int n,m; 8 int record[101]; 9 int set[101];10 11 void Dijkstra_init()12 {13 int a,b,c,i;14 memset(map,INF,sizeof( 阅读全文

posted @ 2012-07-21 18:25 coding封神 阅读(125) 评论(0) 推荐(0)

【解题报告】【HDOJ2544】【Floyd最短路】最短路
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2544 1 #include<stdio.h> 2 #include<string.h> 3 #define INF 0x3f3f3f3f 4 #define min(a,b) (a>b?b:a) 5 int map[101][101]; 6 int main() 7 { 8 int n,m,i,j,k,a,b,c; 9 //freopen("1.txt","r",stdin);10 while(scanf("%d%d& 阅读全文

posted @ 2012-07-21 18:23 coding封神 阅读(159) 评论(0) 推荐(0)

【解题报告】【HDOJ1874】【Floyd最短路】畅通工程续
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1874注意重边和环:1.重边在读取的时候用min选取最小的2.环则在输出时进行判断 1 #include<stdio.h> 2 #include<string.h> 3 #define INF 0x3f3f3f3f 4 #define min(a,b) (a>b?b:a) 5 long int map[201][201]; 6 int main() 7 { 8 9 long int n,m,a,b,i,j,k,c; 10 //freopen("1.txt&qu 阅读全文

posted @ 2012-07-21 18:21 coding封神 阅读(123) 评论(0) 推荐(0)

【解题报告】【HDOJ1596】【Floyd最短路】find the safest road
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1596 1 #include<stdio.h> 2 #include<string.h> 3 #define max(a,b) (a>b?a:b) 4 double map[1005][1005]; 5 int n; 6 int main() 7 { 8 int t,i,j,k; 9 //freopen("1.txt","r",stdin);10 while(scanf("%d",&n)!=EOF)11 阅读全文

posted @ 2012-07-21 18:14 coding封神 阅读(116) 评论(0) 推荐(0)

导航