摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3339 #include<iostream>#include<cstdio>#include<cstring>#include<cstdlib>#define INF 900000000#define Max 120using namespace std;int dp[450000000],dis[104... 阅读全文
posted @ 2012-08-30 22:49 Yogurt Shen 阅读(128) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1869 #include<stdio.h>#define INF 0xffffff#define N 105int map[N][N];int i,j,k;void floyd(int n){ for(k=0;k<n;k++) for(i=0;i<n;i++) for... 阅读全文
posted @ 2012-08-30 22:46 Yogurt Shen 阅读(125) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1385 #include<iostream>#include<cstdio>#include<cstring>#include<cstdlib>#define INF 0x7fffff#define N 110using namespace std;int dis[N][N],path[N][N],tax... 阅读全文
posted @ 2012-08-30 22:41 Yogurt Shen 阅读(128) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1224 #include<stdio.h>#include<string.h>int map[110][110],dp[110],pre[110],inst[110];void output( int x ){ if(x==-1) return; output(pre[x]); ... 阅读全文
posted @ 2012-08-30 22:37 Yogurt Shen 阅读(229) 评论(0) 推荐(0) 编辑
摘要: http://ac.jobdu.com/problem.php?pid=1008 #include<iostream>#include<cstdio>#include<cstring>#define INF 0xfffffffusing namespace std;int map[1005][1005],money[1005][1005],dis[1005],pri[1005],sign[... 阅读全文
posted @ 2012-08-30 22:32 Yogurt Shen 阅读(324) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2680 #include<stdio.h>#include<string.h>#define INF 0xfffffff#define N 1002int map[N][N],dis[N],vis[N],n,m,min;void dijkstra(int s){ int i,j,k; mems... 阅读全文
posted @ 2012-08-30 22:15 Yogurt Shen 阅读(138) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1232 #include<stdio.h>#define MAX 1005int fa[MAX];int find(int x){ return fa[x]==x?x:fa[x]=find(fa[x]);}void merge(int x,int y){ x=find(x); y=fin... 阅读全文
posted @ 2012-08-30 22:08 Yogurt Shen 阅读(90) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1598 #include<iostream>#include<cstdio>#include<cstdlib>#define INF 10000000#define N 1000using namespace std;int n,m;struct Edge { int s,t,w;}edge[N+1... 阅读全文
posted @ 2012-08-30 22:05 Yogurt Shen 阅读(161) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1198 感觉写的挺吊的。。。 #include<stdio.h>#include<string.h>int U[7],D[7],R[7],L[7],num[2504],fa[2504];char map[54][54],mapUD[100][100],mapLR[100][100]; void prep... 阅读全文
posted @ 2012-08-30 21:59 Yogurt Shen 阅读(128) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1162 #include<stdio.h>#include<math.h>#include<string.h>#define INF 0x3f3f3f3f#define N 110struct Node{ double x,y;}node[N];int vis[N],n;double map[N][... 阅读全文
posted @ 2012-08-30 21:54 Yogurt Shen 阅读(121) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1301 #include<iostream>#include<cstdio>#include<cstring>#define INF 0xfffffffint map[28][28],f[133],n,vis[28],dis[28],min;void prim(){ int i,j,k,ans=0;... 阅读全文
posted @ 2012-08-30 21:52 Yogurt Shen 阅读(172) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3371 #include<stdio.h>#include<string.h>#define INF 0x7fffffff#define MAX 505int sum,flag,num;void Prim(int map[][MAX],int n) { int dis[MAX],vis[M... 阅读全文
posted @ 2012-08-30 21:49 Yogurt Shen 阅读(141) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1879 #include<stdio.h>#define INF 0xfffffff#define N 105int map[N][N],vis[N],low[N],n;void prim(){ int i,j,k,min,sum=0; for(i=1;i<=n;i++) low[... 阅读全文
posted @ 2012-08-30 21:44 Yogurt Shen 阅读(111) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1875 #include<stdio.h>#include<math.h>#define INF 9999999#define N 110double map[N][N];void prim(int n){ int i,j,k,flag,vis[N]; double low[N],sum,mi... 阅读全文
posted @ 2012-08-30 21:40 Yogurt Shen 阅读(119) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1863 #include<iostream>#include<cstdio>#define N 5050using namespace std;int fa[N],sum,n,m; struct edge { int s,t,w;}e[N];int cmp(const void *a,const v... 阅读全文
posted @ 2012-08-30 21:35 Yogurt Shen 阅读(140) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1233 #include<stdio.h>#include<string.h>#define INF 1000000000#define N 110int map[N][N],low[N],vis[N],n;void prim(){ int i,j,k,min,sum=0; memset(vi... 阅读全文
posted @ 2012-08-30 21:32 Yogurt Shen 阅读(121) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2421 #include<iostream>#include<cstdio>#include<cstring>#define INF 0x7fffffff#define N 101using namespace std;int map[N][N],low[N],vis[N],n,Q;int prim(){ int i,j,k,mi... 阅读全文
posted @ 2012-08-30 21:26 Yogurt Shen 阅读(154) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1856 #include<stdio.h>#define MAX 10000000int fa[MAX],num[MAX];int find(int x){ return fa[x]==x?x:fa[x]=find(fa[x]);}void merge(int a,int b){ int x,y... 阅读全文
posted @ 2012-08-30 21:22 Yogurt Shen 阅读(149) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1308 #include<iostream>#include<cstdio>#include<cstring>#include<cstdlib>#define maxn 1006using namespace std;struct Edge{ int v, next;}edge[1000005];int name[maxn],in... 阅读全文
posted @ 2012-08-30 21:19 Yogurt Shen 阅读(138) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1272 #include<iostream>#define MAX 100005using namespace std;int fa[MAX],flag,sign[MAX];int find(int x){ return(fa[x]==x?x:find(fa[x]));}void merge(int... 阅读全文
posted @ 2012-08-30 21:09 Yogurt Shen 阅读(123) 评论(0) 推荐(0) 编辑