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)

导航