2011年5月31日

poj 2394

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

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

poj 2472

摘要: #include<iostream>#include<fstream>#include<queue>#include<cmath>using namespace std;struct e{ int data; double w; e *next;};e edge[101];int n,m;double d[101];int v[101];void solve(){ int i,j,k; queue<int> q; for(i=1;i<=n;i++) d[i]=-10000000; d[1]=0; q.push(1); v[1]= 阅读全文

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

poj 2485

摘要: #include<iostream>#include<fstream>using namespace std;int n;int f[501];int rank[501];struct e{ int s,t,w;};e edge[250001];void init(){ for(int i=1;i<=n;i++) { f[i]=i; rank[i]=0; }}int top;void add(int s,int t,int w){ edge[++top].s=s; edge[top].t=t; edge[top].w=w;}int cmp(const void * 阅读全文

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

poj 2570

摘要: #include<iostream>#include<fstream>using namespace std;int n;int map[201][201];void read(){// ifstream cin("in.txt"); int i,j,k; char c[30]; while(cin>>n) { if(n==0) return; memset(map,0,sizeof(map)); while(cin>>i>>j) { if(i==0&&j==0) break; cin>> 阅读全文

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

poj 2457

摘要: #include<iostream>#include<fstream>#include<queue>using namespace std;struct e{ int data; e *next;};e edge[50001];void add(int s,int t){ e *p=new e; p->data=t; p->next=edge[s].next; edge[s].next=p;}int path[50001];int v[50001];int n,m;int solve(){ int i,j,k; queue<int> 阅读全文

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

poj 2135

摘要: #include<iostream>#include<fstream>#include<queue>using namespace std;struct e{ int data; int c,f; int w; e *next; e *opt;};e edge[1010];int total;int n,m;void add(int s,int t,int h,int w){ e *p=new e; p->data=t; p->c=h; p->f=0; p->w=w; p->next=edge[s].next; edge[s]. 阅读全文

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

导航