上一页 1 2 3 4 5 6 7 ··· 99 下一页

2012年10月5日

stl pair

摘要: #include<stdio.h>#include<stdlib.h>#include<string.h>#include<iostream>#include<vector>#include<string>#include<math.h>#include<time.h>#include<map>#include<set>#include<algorithm>using namespace std;pair<int,int>p[1000];int mai 阅读全文

posted @ 2012-10-05 21:02 more think, more gains 阅读(205) 评论(0) 推荐(0) 编辑

随机化算法

摘要: 无比膜拜这个犀利的随机化算法#include <algorithm>#include <cstdio>#include <cstdlib>#define MAX 300000#define ITER 100using namespace std;typedef pair<int,int> par;inline int myrand() { int a = rand()%5000; int b = rand()%5000; return a*5000+b;}int n, Q, C;int a[MAX];par b[MAX];int main( vo 阅读全文

posted @ 2012-10-05 21:00 more think, more gains 阅读(174) 评论(0) 推荐(0) 编辑

2012年9月26日

后缀数组应用5: 求两个不同字串串的最长公共子串

摘要: 求两个不同字串串的最长公共子串依然是将两个字串串拼接在一起。。然后求sa,height数组,最后枚举height值。。View Code #include<stdio.h>#include<stdlib.h>#include<string.h>#include<iostream>#include<vector>#include<string>#include<math.h>#include<map>#include<set>#include<algorithm>using n 阅读全文

posted @ 2012-09-26 16:32 more think, more gains 阅读(175) 评论(0) 推荐(0) 编辑

后缀数组应用4: 求不可重叠最长重复子串

摘要: View Code #include<stdio.h>#include<stdlib.h>#include<string.h>#include<iostream>#include<vector>#include<string>#include<math.h>#include<map>#include<set>#include<algorithm>using namespace std;#define MAXN 10010int sa[MAXN], rank[MAXN], su 阅读全文

posted @ 2012-09-26 16:16 more think, more gains 阅读(209) 评论(0) 推荐(0) 编辑

后缀数组应用3: 求子串个数

摘要: View Code #include<stdio.h>#include<stdlib.h>#include<string.h>#include<iostream>#include<vector>#include<string>#include<math.h>#include<map>#include<set>#include<algorithm>using namespace std;#define MAXN 10010int sa[MAXN], rank[MAXN], su 阅读全文

posted @ 2012-09-26 16:14 more think, more gains 阅读(381) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 ··· 99 下一页

导航