- 博客(3)
- 收藏
- 关注
转载 ACM常用算法及练习
第一阶段:练经典常用算法,下面的每个算法给我打上十到二十遍,同时自己精简代码,因为太常用,所以要练到写时不用想,10-15分钟内打完,甚至关掉显示器都可以把程序打出来. 1.最短路(Floyd、Dijstra,BellmanFord) 2.最小生成树(先写个prim,kruscal要用并查集,不好写) 3.大数(高精度)加减乘除 4.二分查找. (代码可在五行以内) 5.叉乘、判线段相交、然
2009-08-15 15:48:00
248
原创 poj2485kruskal
#include#include#include#includeusing namespace std;struct E{ int x,y,w;}edges[250010];int father[510];bool cmp(E a,E b){ return (a.w}int Find(int pos){ if (father[pos]==pos) return pos;
2009-08-15 15:46:00
237
原创 poj2485prim
#include#include#include#define INF 2000000000using namespace std;bool s[510];int dis[510],map[510][510];void prim(const int n){ int u=1,sum=0; dis[1]=0; for (int i=1;i int min=INF; fo
2009-08-15 15:37:00
223
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人