2011年6月26日

poj 2436

摘要: dfs代码:#include<iostream>#include<fstream>using namespace std;int cow[1001];int n,d,k;int ans;int b[16];void solve(int s,int t,int p){ int i,j; if(d-s+1<k-t) return; if(t==k) { j=0; for(i=1;i<=n;i++) if(cow[i]==(cow[i]&p)) j++; if(j>ans) ans=j; return; } solve(s+1,t+1,p|(1< 阅读全文

posted @ 2011-06-26 21:53 宇宙吾心 阅读(169) 评论(0) 推荐(0)

poj 3411

摘要: 有意思的dfs代码:#include<iostream>#include<fstream>#include<vector>using namespace std;struct node{ int c,p,r,data;};vector<node> edge[11];int n,m;int v[11];int ans;void solve(int s,int w){ int i,j,k; if(w>ans) return; if(s==n) { ans=w; return ; } for(i=0;i<edge[s].size();i++ 阅读全文

posted @ 2011-06-26 21:18 宇宙吾心 阅读(322) 评论(0) 推荐(0)

导航