04 2013 档案

摘要:看了别人代码后才想明白的。还得多加练习搜索题!#include <iostream>using namespace std;char Map[9][9];bool place_c[9];int number_p;int tol;int n,k;bool can_place(int i,int j){ return !place_c[j]&&Map[i][j]=='#';}void DFS(int i){ if(number_p==k) { tol++; return; } if(i>=n) return; int j... 阅读全文
posted @ 2013-04-19 13:54 algorithms爱好者 阅读(83) 评论(0) 推荐(0)
摘要:C语言,数据结构,算法!!! 阅读全文
posted @ 2013-04-18 18:04 algorithms爱好者 阅读(90) 评论(0) 推荐(0)
摘要:#include <iostream>#define M 50005using namespace std;int n,m,fa[M];int find_fa(int x){ while(fa[x]!=x) { x=fa[x]; } return x;}void merg(int x,int y){ if(find_fa(x)!=find_fa(y)) { fa[find_fa(x)]=find_fa(y); }}int main(){ int i,a,b,sum,si=... 阅读全文
posted @ 2013-04-18 14:05 algorithms爱好者 阅读(94) 评论(0) 推荐(0)
摘要:#include <iostream>#include<algorithm>using namespace std;void qsort(int arr[],int sta,int end){ if(sta<end) { int x,i=sta,j=end; x=arr[i]; while(i<j) { while(arr[j]>x&&i<j) { j--; } if(i<j) { arr[i++]=arr[j]; } while(arr[i]<=x&&i<j) { i++; } if(i< 阅读全文
posted @ 2013-04-14 14:52 algorithms爱好者 阅读(110) 评论(0) 推荐(0)
摘要:#include<iostream>using namespace std;const int M = 6010;int V[M][2];int fa[M];int n;int Max(int a,int b){ return a>b?a:b;}void calculator(int node){ int i; for(i=1;i<=n;i++) { if(fa[i]==node) { calculator(i); V[node][1]+=V[... 阅读全文
posted @ 2013-04-08 11:46 algorithms爱好者 阅读(107) 评论(0) 推荐(0)