上一页 1 2 3 4 5 6 ··· 9 下一页
摘要: int cmptime(char *p,char *q,int n){ int times=0,i; int lenp=strlen(p); int lenq=strlen(q); if(lenp<n||lenq<n) return 0; char *tq=q; while(lenq>=n) { for(i=0;i<n;i++) { if(p[i]!=tq[i]) break; } if(i<n) return times; else { times++; tq=tq+n; lenq=lenq-n; } } return times;}int lgstrtime( 阅读全文
posted @ 2012-08-11 15:59 wuzhibin 阅读(209) 评论(0) 推荐(0) 编辑
摘要: a b d f g e h i c k j: 前序f d g b h e i a k c j:中序0 1 2 3 4 5 6 7 8 9 10用前序的首字母 将中序分割成两段 分别对应左右子树关键在于如何得到这两段 很简单 :在中序里 a的序号为7,从而0-7 为左子树,这一段相应在前序中序号为 1-8(前点虽然不同,但长度相同) b d f g e h i : 前序f d g b h e i :中序char post[1000];char pre[1000];char mid[1000];int getroot(char r){ int i=0; while(mid[i]!='\0& 阅读全文
posted @ 2012-08-11 14:43 wuzhibin 阅读(184) 评论(0) 推荐(0) 编辑
摘要: /*ID:billat11LANG:CTASK:namenum*/#include<iostream>#include<cstdio>#include<cstdarg>#include<stdlib.h>#include<cstring>#include<cmath>using namespace std;const int N=100005;struct node{ int l; int r; int times;}allNode[3*N];void build(int l,int r,int n){ if(l==r) 阅读全文
posted @ 2012-06-15 20:35 wuzhibin 阅读(444) 评论(0) 推荐(0) 编辑
摘要: 法一:二维线段树#include<iostream>#include<cstdio>#include<cstdarg>#include<stdlib.h>#include<cstring>#include<cmath>using namespace std;const int N=10005;struct Node{ int xMin; int xMax; int yMin; int yMax; int area; bool cover;}aNode[3*N];void build(int xMin,int xMax,in 阅读全文
posted @ 2012-06-15 15:44 wuzhibin 阅读(276) 评论(0) 推荐(0) 编辑
摘要: /*ID:billat11LANG:CTASK:namenum*/#include<iostream>#include<cstdio>#include<cstdarg>#include<stdlib.h>#include<cstring>#include<cmath>using namespace std;const int N=50005;struct Node{ int l; int r; int num;}aNode[4*N];int data[N];void build(int l,int r,int n){ in 阅读全文
posted @ 2012-06-10 16:52 wuzhibin 阅读(1215) 评论(0) 推荐(1) 编辑
摘要: /*ID:billat11LANG:CTASK:namenum*/#include<iostream>#include<cstdio>#include<cstdarg>#include<stdlib.h>#include<cstring>#include<cmath>using namespace std;const int N=200005;struct Node{ int left; int right; int maxScore; int score;}allNode[4*N];int data[N+5];inlin 阅读全文
posted @ 2012-06-10 15:48 wuzhibin 阅读(282) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>#include <iostream>#include <fstream>#include <vector>#include <exception>#include <cstring>#include <stdlib.h>using namespace std;const int Len=10000;const int L=1000005;int next[Len+5];int str2[Len+5],str1[L];void getNext(int next[],int s 阅读全文
posted @ 2012-06-08 16:19 wuzhibin 阅读(594) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>#include <iostream>#include <fstream>#include <vector>#include <exception>#include <cstring>#include <stdlib.h>using namespace std;const int Len=1000000;int next[Len+5];void getNext(int next[],char str[]){ int len=strlen(str); int i=0,j=-1; 阅读全文
posted @ 2012-06-08 16:02 wuzhibin 阅读(385) 评论(0) 推荐(0) 编辑
摘要: /*This Code is Submitted by billforum for Problem 1952 at 2012-06-08 15:39:09*/#include <stdio.h>#include <iostream>#include <fstream>#include <vector>#include <exception>#include <cstring>#include <stdlib.h>using namespace std;const int Len=1000000;int next 阅读全文
posted @ 2012-06-08 15:42 wuzhibin 阅读(218) 评论(0) 推荐(0) 编辑
摘要: /*ID:billat11LANG:CTASK:namenum*/#include<iostream>#include<cstdio>#include<cstdarg>#include<stdlib.h>#include<cstring>#include<cmath>using namespace std;const int Len=300;//int 6int c[Len+1];int all[1006][Len+1];void add(int a[],int b[]) { memset(c,0,sizeof(c)); 阅读全文
posted @ 2012-06-06 21:25 wuzhibin 阅读(124) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 9 下一页