摘要: Kruskal#include#include#include#includeusing namespace std;const int maxn=120;int fa[maxn];int n;struct node{ int s,t; double w;} edge[maxn*maxn... 阅读全文
posted @ 2015-08-13 15:12 雲碧 阅读(94) 评论(0) 推荐(0)
摘要: 并查集+最小生成树#include#include#include#includeusing namespace std;const int M=124;const int N=124*124;int fa[M];int m,n;int find(int x){ if(fa[x]!=x) fa... 阅读全文
posted @ 2015-08-13 15:09 雲碧 阅读(97) 评论(0) 推荐(0)
摘要: 矩阵快速幂。#include#include#include#includeusing namespace std;const int maxn=25;const int MOD=1000;int x,y,s,t,m,n,k;struct node{ int matrix[maxn][maxn... 阅读全文
posted @ 2015-08-11 14:11 雲碧 阅读(128) 评论(0) 推荐(0)
摘要: 简单的拓扑排序,按字典序输出。#include#include#include#include#include#includeusing namespace std;int n,m,u,v;const int maxn=1111;//设置节点数量int InDegree[maxn];//入度int ... 阅读全文
posted @ 2015-08-11 11:30 雲碧 阅读(101) 评论(0) 推荐(0)