摘要: 题目连接:http://poj.org/problem?id=2485题意比较明显。。。就是求最小生成树里的最长路,其实用dijks也可以。。。View Code 1 #include <iostream> 2 #include <stdio.h> 3 #define max 65536; 4 using namespace std; 5 6 int map[505][505]; 7 int ans; 8 void init(int n) 9 {10 int i,j;11 for(i = 1;i <= n;i++)12 {13 for(j = 1;j... 阅读全文
posted @ 2012-11-13 20:15 某某。 阅读(126) 评论(0) 推荐(0) 编辑
摘要: 题目连接:http://poj.org/problem?id=1789每条边的权值为任意两truck不相等字母的数量,求最小生成树代码:View Code 1 #include <iostream> 2 #include <stdio.h> 3 #include <string.h> 4 #define max 1000000 5 using namespace std; 6 int map[2005][2005]; 7 int ans; 8 void prim(int n) 9 {10 int i,pre,j,min;11 int vis[2005] = 阅读全文
posted @ 2012-11-13 18:23 某某。 阅读(158) 评论(0) 推荐(0) 编辑
摘要: 题目连接:http://poj.org/problem?id=2240思路:直接见图,floyd一遍之后看是否有自身大于一的。注意是有向图代码:View Code 1 #include <iostream> 2 #include <map> 3 #include <string> 4 #include <stdio.h> 5 using namespace std; 6 map<string,int> st; 7 string s1,s2; 8 double mp[50][50]; 9 void init(int n)10 {11 i 阅读全文
posted @ 2012-11-13 17:43 某某。 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 题目连接:http://poj.org/problem?id=1125题目就是要求你算每个点在能够到达所有点的情况下求到达所有点的费时中最大的最小值及其起点,如果不能到达直接输出disjoint。代码View Code 1 #include <iostream> 2 #include <stdio.h> 3 #define max 1000000 4 using namespace std; 5 int map[106][105]; 6 void init(int n) 7 { 8 int i,j; 9 for(i = 1;i <= n;i++)10 {11 .. 阅读全文
posted @ 2012-11-13 16:59 某某。 阅读(156) 评论(0) 推荐(0) 编辑