2017年4月1日

kruskal算法

摘要: const int maxn=28; struct Edge{ int u,v,w; bool operator <(const Edge &rhs) const{ return w<rhs.w; } }edges[maxn*maxn]; int f[maxn]; void init(int N){ for(int i=1;i<=N;i++) ... 阅读全文

posted @ 2017-04-01 20:28 mkfoy 阅读(189) 评论(0) 推荐(0)

prime算法模板

摘要: 邻接矩阵的实现int prime(int cost[][MAXV],int n){ bool vis[MAXV]; int dis[MAXV]; memset(vis,false,sizeof(vis)); fill(dis,dis+MAXV,INF); int ans=0; dis[0]=0; for(int j=1;jcost[k][... 阅读全文

posted @ 2017-04-01 20:06 mkfoy 阅读(431) 评论(0) 推荐(0)

POJ 2001 Shortest Prefixes

摘要: 传送门:http://poj.org/problem?id=2001 解题思路: 简单的字典树 实现代码: 阅读全文

posted @ 2017-04-01 19:04 mkfoy 阅读(148) 评论(0) 推荐(0)

字典树模板

摘要: const int N=27; struct node{ int cnt; node* childs[N]; node(){ cnt=0; for(int i=0;ichilds[m]!=NULL){ current=current->childs[m]; ++(current->cnt);... 阅读全文

posted @ 2017-04-01 09:07 mkfoy 阅读(157) 评论(0) 推荐(0)

HDU 1251 统计难题

摘要: 传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1251 解题思路: 一个简单的字典树问题。 实现代码: 阅读全文

posted @ 2017-04-01 09:06 mkfoy 阅读(94) 评论(0) 推荐(0)

导航