摘要: 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 阅读(321) 评论(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) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1213 并查集第一题 #include<iostream>#include<cstdio>#include<cstring>using namespace std;int fa[1010];int find(int x){ if(fa[x]) return fa[x]=find(f... 阅读全文
posted @ 2012-08-30 21:01 Yogurt Shen 阅读(95) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3342 #include<stdio.h>#include<string.h>int map[1000][1000];int main(void){ int i,j,k,flag,n,m,x,y; while(scanf("%d%d",&n,&m)&&(n||m)) { m... 阅读全文
posted @ 2012-08-30 20:53 Yogurt Shen 阅读(128) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1596 模板题 #include<stdio.h>#include<stdlib.h>#define N 1005int n,m;float map[N][N],dis[N][N];void floyd(){ int i,j,k; for(i=1;i<=n;i++) for(j=... 阅读全文
posted @ 2012-08-30 20:50 Yogurt Shen 阅读(200) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=3615 模板题 #include<iostream>#include<cstdio>#include<algorithm>#define INF 1<<28#define N 310using namespace std;int map[N][N] ;int main(void){ int n,m,t,i,j,k,a,b; ... 阅读全文
posted @ 2012-08-30 20:46 Yogurt Shen 阅读(131) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=3377 #include<iostream>#include<cstdio>#include<cstring>#include<queue>#define N 2000005using namespace std;const __int64 INF=999999999999999999LL;struct node{ int v,n... 阅读全文
posted @ 2012-08-30 20:43 Yogurt Shen 阅读(281) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1062 看了别人的题解后写的 #include<iostream>#include<cstring>#define INF 0x7fffffffusing namespace std; int price[101][101],lv[101],sub[101],dist[101],vist[101],M,N; void data... 阅读全文
posted @ 2012-08-30 20:25 Yogurt Shen 阅读(194) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1734 #include<iostream>#include<cstdio>#include<cstring>#include<algorithm>#define INF 0x7ffffff#define N 101using namespace std;int map[N][N],dis[N][N],pre[N][N],path[N]... 阅读全文
posted @ 2012-08-30 20:14 Yogurt Shen 阅读(160) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3631 #include<iostream>#include<cstdio>#include<cstring>#define INF 0x3f3f3f3f#define n 305using namespace std;int map[n][n],M,N,Q;bool used[n]; inline vo... 阅读全文
posted @ 2012-08-30 20:08 Yogurt Shen 阅读(171) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1724 #include<iostream>#include<queue>#define INF 1000000000#define MAXR 105 using namespace std;int E,N,M,s,d,l,t,dis[MAXR],i;struct Node{ int d,l,t; friend boo... 阅读全文
posted @ 2012-08-30 20:01 Yogurt Shen 阅读(155) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1511 模板题 #include<iostream>#include<cstdio>#include<cstring>#include<queue>#define INF 1000000005#define MAXN 1000005using namespace std;int head[MAXN],dis[MAXN],vis[MAX... 阅读全文
posted @ 2012-08-30 19:58 Yogurt Shen 阅读(133) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=3660 模板题 #include<stdio.h>#include<string.h>#define INF 0x7fffffff#define N 110int map[N][N],n,m;void floyd(){ int i,j,k; for(k=1;k<=n;k++) for(i=1;i<=n;i++)... 阅读全文
posted @ 2012-08-30 19:54 Yogurt Shen 阅读(136) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1797 简单 #include<stdio.h>#include<string.h>#define N 1002int map[N][N],dis[N],vis[N],n,m,Max;void dijkstra(){ int i,j,k; memset(vis,0,sizeof(vis)); memset(dis,0... 阅读全文
posted @ 2012-08-30 19:46 Yogurt Shen 阅读(131) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=3268 把地图转置一下就OK。 #include<stdio.h>#include<string.h>#define INF 0xfffffff#define N 1005int map1[N][N],map2[N][N],dis1[N],dis2[N],vis[N],n,m,x;void dijkstra(){ int i,j... 阅读全文
posted @ 2012-08-30 19:41 Yogurt Shen 阅读(133) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2263 莫非当初随便百度了个 #include<iostream>#include<cstdio>#include<string>#include<cmath>#include<map>#define N 202using namespace std;int gra[N][N],dis[N],vis[N],n;void dijkstr... 阅读全文
posted @ 2012-08-30 19:39 Yogurt Shen 阅读(119) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=3259 越看越不像我写的了- - #include<stdio.h>#define INF 0x0fffffffstruct type{ int s,t,len;}edge[30000];int d[505],n,m,w,nedge=0;bool Bellman_Ford(){ int j,k,u,v; bool ... 阅读全文
posted @ 2012-08-30 19:35 Yogurt Shen 阅读(150) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=3159 怎么好像又不是我写的- -。。。 #include<iostream> #include<cstdio>#include<cstring>#include<queue>#define INF 999999999using namespace std;struct node{ int y,v,next;}a[15... 阅读全文
posted @ 2012-08-30 19:24 Yogurt Shen 阅读(162) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2502 好像不是我写的- -?风格略不像啊 #include<iostream>#include<cstdio>#include<cstring>#include<cmath>#include<cstdlib>#define maxn 205using namespace std;struct Point{ double x, ... 阅读全文
posted @ 2012-08-30 18:42 Yogurt Shen 阅读(123) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2066 G++ 46ms,C++超时- -。。。 #include<stdio.h>#include<string.h>#define INF 0xfffffff#define N 1002int map[N][N],vis[N],dis[N],near[N],des[N],n,T,S,D;int di... 阅读全文
posted @ 2012-08-30 18:33 Yogurt Shen 阅读(252) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2387 自己在纸上比划比划就比较清楚 #include<stdio.h>#include<string.h>#define INF 0xfffffff#define N 1002int map[N][N],vis[N],dis[N],min,t,n;void dijkstra(){ int i,j,k; memset(vi... 阅读全文
posted @ 2012-08-30 18:31 Yogurt Shen 阅读(135) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2253 也是红皮上的 #include<stdio.h>#include<string.h>#include<math.h>#define INF 999999.000#define N 202float map[N][N],dis[N],min,max;bool vis[N];int n,p=0;struct{ int x,y... 阅读全文
posted @ 2012-08-30 18:29 Yogurt Shen 阅读(150) 评论(0) 推荐(0) 编辑