摘要: POJ 1258 最小生成树模板Kruskal算法#include#include#include#include#include#include#include#include#include#include#define max(a, b) a>b?a:b;#define min(a, b) a... 阅读全文
posted @ 2015-07-25 11:09 花开须臾 阅读(212) 评论(0) 推荐(0) 编辑
摘要: #include#include#include#include#include#include#include#include#include#include#define max(a, b) a>b?a:b;#define min(a, b) a<b?a:b;using namespace st... 阅读全文
posted @ 2015-07-25 08:26 花开须臾 阅读(160) 评论(0) 推荐(0) 编辑
摘要: #include#include#include#include#include#include#include#include#include#include#define max(a, b) a>b?a:b;#define min(a, b) a<b?a:b;using namespace st... 阅读全文
posted @ 2015-07-24 12:57 花开须臾 阅读(152) 评论(0) 推荐(0) 编辑
摘要: #include#include#includeusing namespace std;const int N = 100005;int r[N], father[N];//定义一个关系数组,定义一个父亲(路径)数组;int Find(int x);//寻找根节点,并且找这个点与根节点的关系int ... 阅读全文
posted @ 2015-07-24 12:56 花开须臾 阅读(111) 评论(0) 推荐(0) 编辑
摘要: 这里要补充一些知识点,并查集三操作1.找到父节点递归写法int Findf(int x){ if(father[x]!=x) father[x]=Findf(father[x]); return father[x];}另一种写法int Findf(int x){ in... 阅读全文
posted @ 2015-07-22 15:16 花开须臾 阅读(152) 评论(0) 推荐(0) 编辑
摘要: #include#include#include#include#include#include#include#include#include#includeusing namespace std;#define max(a, b) a>b?a:b#define min(a, b) aque; ... 阅读全文
posted @ 2015-07-21 13:47 花开须臾 阅读(164) 评论(0) 推荐(0) 编辑
摘要: http://acm.hust.edu.cn/vjudge/contest/view.action?cid=82829#rank#include#include#include#include#include#include#include#includeusing namespace std;#... 阅读全文
posted @ 2015-07-20 20:42 花开须臾 阅读(178) 评论(0) 推荐(0) 编辑
摘要: http://acm.hust.edu.cn/vjudge/contest/view.action?cid=82828#problem/N这两天总是因为一些小错误耽误时间,我希望自己可以细心点。珍惜时间,珍爱生命!#include#include#include#include#include#in... 阅读全文
posted @ 2015-07-20 10:23 花开须臾 阅读(163) 评论(0) 推荐(0) 编辑
摘要: http://acm.hust.edu.cn/vjudge/contest/view.action?cid=82828#problem/F经验就是要认真细心,要深刻理解。num#include#include#include#include#include#include#include#inclu... 阅读全文
posted @ 2015-07-18 17:43 花开须臾 阅读(120) 评论(0) 推荐(0) 编辑
摘要: #include#include#include#include#include#include#include#includeusing namespace std;#define INF 0xfffffff#define N 1010int maps[N][N], dist[N];//dista... 阅读全文
posted @ 2015-07-18 14:16 花开须臾 阅读(132) 评论(0) 推荐(0) 编辑