上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 36 下一页

2011年6月15日

poj 1862

摘要: 贪心#include<iostream>#include<fstream>#include<cmath>#include<queue>using namespace std;int n;void read(){// ifstream cin("in.txt"); int i,j,k; double s,t; cin>>n; priority_queue<double> q; for(i=1;i<=n;i++) { cin>>j; t=j; q.push(t); } while(1) { 阅读全文

posted @ 2011-06-15 15:50 宇宙吾心 阅读(187) 评论(0) 推荐(0)

2011年6月2日

poj 2065

摘要: #include<iostream>#include<fstream>#include<cmath>using namespace std;int n,m,p;int map[74][74];int find(int s,int t){ s=(s%p+p)%p; t=(t%p+p)%p; for(int i=0;i<p;i++) if((i*t)%p==s) return i;}void solve(){ int i,j,k,s,t,a,b; j=0; for(i=0;i<n&&j<m;i++,j++) { s=0;t=0; 阅读全文

posted @ 2011-06-02 11:06 宇宙吾心 阅读(242) 评论(0) 推荐(0)

poj 1611

摘要: #include<iostream>#include<fstream>using namespace std;int f[30001],rank[30001];int n,m;void init(){ int i; for(i=0;i<=n;i++){ f[i]=i; rank[i]=0; }}int father(int s){ if(s!=f[s]) f[s]=father(f[s]); return f[s];}void unionset(int s,int t){ int i=father(s); int j=father(t); if(rank[i]&l 阅读全文

posted @ 2011-06-02 10:36 宇宙吾心 阅读(189) 评论(0) 推荐(0)

poj 1789

摘要: #include<iostream>#include<fstream>#include<queue>using namespace std;char c[2001][8];int map[2001][2001];int ok(int s,int t){ int j=0; for(int i=0;i<7;i++) { if(c[s][i]!=c[t][i]) j++; } return j;}int d[2001];int v[2001];int n;void solve(){ int i,j,k; for(i=1;i<=n;i++) d[i]=m 阅读全文

posted @ 2011-06-02 10:26 宇宙吾心 阅读(238) 评论(0) 推荐(0)

2011年6月1日

poj 2139

摘要: #include<iostream>#include<fstream>using namespace std;int map[301][301];int n,m;int a[301];void read(){// ifstream cin("in.txt"); int i,j,k,s,t; cin>>n>>m; memset(map,-1,sizeof(map)); for(i=1;i<=m;i++) { cin>>k; for(j=1;j<=k;j++) cin>>a[j]; for(s= 阅读全文

posted @ 2011-06-01 17:06 宇宙吾心 阅读(327) 评论(0) 推荐(0)

poj 2349

摘要: #include<iostream>#include<fstream>#include<cmath>using namespace std;int n,m;struct e{ int s,t; double w;};e edge[250001];int x[501],y[501];int top;void add(int s,int t,double w){ edge[++top].s=s; edge[top].t=t; edge[top].w=w;};int cmp(const void *a,const void *b){ if( (*(e*)a).w& 阅读全文

posted @ 2011-06-01 17:02 宇宙吾心 阅读(275) 评论(0) 推荐(0)

poj 2075

摘要: #include<iostream>#include<fstream>using namespace std;struct e{ int s,t; double w;};e edge[250001];int n,m;char c[501][30];int cmp(const void *a,const void *b){ if ((*(e*)a).w>(*(e*)b).w) return 1; return -1;}int top;void add(int s,int t,double w){ edge[++top].s=s; edge[top].t=t; edg 阅读全文

posted @ 2011-06-01 17:01 宇宙吾心 阅读(253) 评论(0) 推荐(0)

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 宇宙吾心 阅读(237) 评论(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)

上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 36 下一页

导航