上一页 1 ··· 19 20 21 22 23 24 25 26 27 ··· 34 下一页

2012年7月31日

poj 1860 Currency Exchange (Bellman_Ford)

摘要: 点击打开链接 第一次写Bellman_Ford.. #include"stdio.h"int n,m,start;double money,rab,rba,cba,cab;struct node{ int x,y; double r,c;}map[210];double d[210];int... 阅读全文

posted @ 2012-07-31 19:40 Slege 阅读(93) 评论(0) 推荐(0) 编辑

hdu 1548 A strange lift (bfs)

摘要: 点击打开链接 简单BFS。。 #include"stdio.h"#include"string.h"#include"queue"using namespace std;struct node{ int x,step;}q,p;int main(){ int d[201],mark[202]... 阅读全文

posted @ 2012-07-31 18:42 Slege 阅读(83) 评论(0) 推荐(0) 编辑

POJ 3626 Mud Puddles (BFS)

摘要: 点击打开链接 将所有的数据都+500,然后模版。。 #include"stdio.h"#include"string.h"#include"queue"using namespace std;int d[4][2]={1,0,0,1,-1,0,0,-1};int x,y,n,map[1001... 阅读全文

posted @ 2012-07-31 18:39 Slege 阅读(117) 评论(0) 推荐(0) 编辑

hdu 3367 Pseudoforest (krusual)

摘要: 点击打开链接 求一个最大的生成森林,每个连通的部分最多有一个环,求其权值最大的森林。。。。 比如说各个点都有各自的一个集合,那么对于新读入的2点,若他们这个集合里面已经有环,就不能在忘这里面添加边了,再添加边必定会构成新的环,若他们属于两个不同的集合,若他们两个集合都有环了,不能在把他们连起... 阅读全文

posted @ 2012-07-31 17:18 Slege 阅读(126) 评论(0) 推荐(0) 编辑

poj 1679 The Unique MST (最小生成树)

摘要: 点击打开链接 判断最小生成树是否唯一! 用prime算法,其中然后加一步:假设枚举到M点如果 ((已经加入生成树中的点到M的权值等于未加入点M的权值)的个数)大于1,则肯定不是唯一! #include"stdio.h"#include"string.h"#define INF 9999999... 阅读全文

posted @ 2012-07-31 15:38 Slege 阅读(105) 评论(0) 推荐(0) 编辑

poj 2253 Frogger (最短路Floyd)

摘要: 点击打开链接 wrong了2次,因为没读懂题!! 唉, 英语好差啊!! 题目大意: 给出两只青蛙的坐标A、B,和其他的n-2个坐标,任一两个坐标点间都是双向连通的。显然从A到B存在至少一条的通路,每一条通路的元素都是这条通路中前后两个点的距离,这些距离中又有一个最大距离。题目要求,必须借助第... 阅读全文

posted @ 2012-07-31 14:41 Slege 阅读(94) 评论(0) 推荐(0) 编辑

poj 2377 Bad Cowtractors (最‘大’生成树)

摘要: 点击打开链接 最小生成树的变形,最大生成树 #include"stdio.h"#include"math.h"#include"string.h"#define INF 0int map[1001][1001],f[1001];int mark[1001],n;void prime(){ i... 阅读全文

posted @ 2012-07-31 11:23 Slege 阅读(142) 评论(0) 推荐(0) 编辑

poj 3625 Building Roads (最小生成树)

摘要: 点击打开链接 坐标类型的最小生成树 注意,所有的距离用double,所有的int用__int64 #include"stdio.h"#include"math.h"#include"string.h"#define INF 100000000double map[1001][1001],f[... 阅读全文

posted @ 2012-07-31 11:10 Slege 阅读(106) 评论(0) 推荐(0) 编辑

poj 1005 I Think I Need a Houseboat

摘要: 点击打开链接 大体意思:半圆表示一块面积可扩展的区域,开始时,面积是0,在(0,0)处开始以每年50平方米的速度同样呈半圆扩展,输入一个正整数N,然后输入N对坐标,对于每一对坐标值:求出面积扩展到该点的年数,坐标值单位为米。 #include"stdio.h"#include"math.h"... 阅读全文

posted @ 2012-07-31 09:43 Slege 阅读(141) 评论(0) 推荐(0) 编辑

zoj 1586 QS Network (最小生成树)

摘要: 点击打开链接 注意每个点也有价值。 #include"stdio.h"#include"string.h"#define INF 1000000000int mark[1001],f[1001],n,map[1001][1001];void prime(){ int i,j,min,k,an... 阅读全文

posted @ 2012-07-31 09:06 Slege 阅读(116) 评论(0) 推荐(0) 编辑

上一页 1 ··· 19 20 21 22 23 24 25 26 27 ··· 34 下一页

导航