2011年5月28日

poj 1135

摘要: 代码:#include<iostream>#include<fstream>#include<queue>using namespace std;struct e{ int data; int cost; e *next;};e edge[501];int n,m;void add(int s,int t,int w){ e *p=new e; p->data=s; p->cost=w; p->next=edge[t].next; edge[t].next=p; e *q=new e; q->data=t; q->cost=w; 阅读全文

posted @ 2011-05-28 10:51 宇宙吾心 阅读(321) 评论(0) 推荐(0)

poj 3653

摘要: 代码:#include<iostream>#include<fstream>#include<queue>using namespace std;int n,m;int total;struct e{ int data; int cost; e *next;};e edge[500];struct node{ int data; int w; friend bool operator <(node a,node b){ return a.w>b.w; }};int d[500],v[500];void solve(){ int i,j,k; me 阅读全文

posted @ 2011-05-28 10:10 宇宙吾心 阅读(281) 评论(0) 推荐(0)

poj 3662

摘要: 代码:#include<iostream>#include<fstream>#include<queue>using namespace std;int n,m,l;struct e{ int data; int cost; e *next;};e edge[1001];void add(int s,int t ,int w){ e *p=new e; p->data=s; p->cost=w; p->next=edge[t].next; edge[t].next=p; e *q=new e; q->data=t; q->cos 阅读全文

posted @ 2011-05-28 10:09 宇宙吾心 阅读(239) 评论(0) 推荐(0)

poj 3686

摘要: 代码:#include<iostream>#include<fstream>using namespace std;int n,m;int link[2501],x[51],y[2501],lx[51],ly[2501];int map[51][51];int w[51][2501];int dfs(int s){ x[s]=1; for(int i=1;i<=m;i++) if(y[i]==0&&lx[s]+ly[i]==w[s][i]) { y[i]=1; if(link[i]==-1||dfs(link[i])) { link[i]=s; r 阅读全文

posted @ 2011-05-28 10:06 宇宙吾心 阅读(268) 评论(0) 推荐(0)

poj 1523

摘要: 代码:#include<iostream>#include<fstream>using namespace std;struct e{ int data; e *next;};e edge[1001];void add(int i,int j){ e *p=new e; p->data=j; p->next=edge[i].next; edge[i].next=p; e *q=new e; q->data=i; q->next=edge[j].next; edge[j].next=q;}int dfn[1001],v[1001],low[1001 阅读全文

posted @ 2011-05-28 10:05 宇宙吾心 阅读(231) 评论(0) 推荐(0)

导航