上一页 1 ··· 32 33 34 35 36 37 38 39 40 ··· 42 下一页
摘要: Ford-Fulkerson算法基本没什么技巧View Code 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 #define N 1005 7 #define inf 9999999 8 int map[N][N],pre[N],vis[N]; 9 int start,eend,ans;10 11 void max_flow(int n)12 {13 int i,j,k;14 while(1)15 {16 queueq;17 while(!q.... 阅读全文
posted @ 2012-10-22 22:33 xxx0624 阅读(280) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include<stdio.h> 2 #include<string.h> 3 #define N 100005 4 int next[N]; 5 int flag,len2,len1; 6 char str1[2*N],str2[N]; 7 8 void getnext() 9 {10 int i,j,k;11 memset(next,0,sizeof(next));12 next[0]=-1;13 j=0;14 k=-1;15 while(j<len2)16 {17 if(k==-1||s... 阅读全文
posted @ 2012-10-22 21:25 xxx0624 阅读(280) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 int in[30],out[30],vis[30]; 8 int n; 9 10 vector edge[27];11 12 void dfs(int s){13 vis[s]=1;14 for(int i=0;i>str;43 len=strlen(str);44 len--;45 out[str[0]-'a']++;46 ... 阅读全文
posted @ 2012-10-17 22:34 xxx0624 阅读(232) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include<stdio.h> 2 #include<string.h> 3 #define int64 __int64 4 #define N 110 5 int64 dp[N][N],f[N]; 6 int main(){ 7 int64 n,i,j,k,p; 8 while(scanf("%I64d%I64d",&n,&k)!=EOF,n+k){ 9 memset(dp,0,sizeof(dp));10 for(i=1;i<=n;i++) {11 scanf("%I64d", 阅读全文
posted @ 2012-10-16 12:48 xxx0624 阅读(225) 评论(0) 推荐(0) 编辑
摘要: 1 #include<stdio.h> 2 #include<string.h> 3 #include<stdlib.h> 4 #define N 20001 5 #define LEFT(x) ((x<<1)+1) 6 #define RIGHT(x) ((x+1)<<1) 7 #define P 阅读全文
posted @ 2012-10-15 22:03 xxx0624 阅读(168) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include<stdio.h> 2 #define N 20005 3 int n,a[N]; 4 void quick_sort(int low,int up){ 5 int i,j,tmp; 6 if(low<up){ 7 i=low; 8 j=up; 9 tmp=a[low];10 while(i!=j){11 while(i<j&&a[j]>tmp)12 j--;13 if(i<j) a[i++]=... 阅读全文
posted @ 2012-10-15 21:14 xxx0624 阅读(257) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string.h> 4 #define N 1026 5 int c[N][N],s; 6 int lowbit(int i){ 7 return i&(-i); 8 } 9 void update(int x,int y,int val){10 int i,j;11 for(i=x;i<=s;i+=lowbit(i))12 for(j=y;j<=s;j+=lowbit(j))13 c[i][j]+=val... 阅读全文
posted @ 2012-10-14 21:38 xxx0624 阅读(281) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string.h> 4 #define N 1005 5 int c[N][N],n; 6 7 int lowbit(int i){ 8 return i&(-i); 9 }10 11 void update(int x,int y,int val){12 int i,j;13 for(i=x;i<=n;i+=lowbit(i))14 for(j=y;j<=n;j+=lowbit(j))15 c[i][j... 阅读全文
posted @ 2012-10-14 21:07 xxx0624 阅读(292) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include<cstdio> 2 #include<cstdlib> 3 #include<algorithm> 4 using namespace std; 5 struct node{ 6 int l,r,val; 7 }aa[1001]; 8 int cmp( const void *a , const void *b ) 9 { 10 node *c = (node *)a; 11 node *d = (node *)b; 12 if(c->l != d->l) return c->l - d->l 阅读全文
posted @ 2012-10-13 18:14 xxx0624 阅读(350) 评论(0) 推荐(0) 编辑
摘要: 01背包View Code 1 #include<cstdio> 2 #include<cstdlib> 3 #include<cstring> 4 #include<iostream> 5 using namespace std; 6 int wi[10000],f[1000050]; 7 int main(){ 8 int i,fmax,n,sum,j; 9 while(scanf("%d%d",&n,&fmax)==2){10 for(i=1,sum=0;i<=n;i++){11 scanf(&qu 阅读全文
posted @ 2012-10-11 21:26 xxx0624 阅读(271) 评论(0) 推荐(0) 编辑
上一页 1 ··· 32 33 34 35 36 37 38 39 40 ··· 42 下一页