摘要:1 #include <stdio.h> 2 #include <string.h> 3 #include <math.h> 4 #include <stdlib.h> 5 int pre[100005]; 6 typedef struct edge 7 { 8 int v; 9 struct ed
阅读全文
摘要:1 #include <cstdio> 2 #include <iostream> 3 #include <cstring> 4 #include <cmath> 5 using namespace std; 6 struct node { 7 int l,r; 8 }; 9 node s[10];
阅读全文
摘要:刚开始想都不用想用了暴力 当然超时。 根据题目要求10000k内存 一般64m内存即可以通过 利用hash函数建立,时间通过。但内存超出了。。。代码1 1 2 3 #include <cstdio> 4 #include <cstring> 5 using namespace std; 6 7 sh
阅读全文
摘要:1 #include <cstdio> 2 #include <cstring> 3 using namespace std; 4 5 int a[1000010],c[1000010]; 6 int N,M; 7 8 int lowbit(int x) 9 { 10 return x&(-x);
阅读全文
摘要:1 #include <cstdio> 2 #include <algorithm> 3 #include <cstring> 4 using namespace std; 5 int n,m,s[1000010],x,y; 6 7 int main() 8 { 9 scanf("%d%d",&n,
阅读全文
摘要:1 #include <cstdio> 2 #include <cstring> 3 #include <queue> 4 #include <stack> 5 #include <algorithm> 6 #include <cmath> 7 using namespace std; 8 9 st
阅读全文
摘要:在KMP算法中,为了确定在匹配不成功时,下次匹配时j的位置,引入了next[]数组,next[j]的值表示P[0...j-1]中最长后缀的长度等于相同字符序列的前缀。 对于next[]数组的定义如下: 1) next[j] = -1 j = 0 2) next[j] = max(k): 0<k<j
阅读全文
摘要:1 #include <iostream> 2 #include <stdio.h> 3 using namespace std; 4 5 static int step = 0; 6 void move ( char sour, char dest ) 7 { 8 printf ( "move f
阅读全文
摘要:1 #include <cstdio> 2 #include <cstring> 3 #include <algorithm> 4 #include <iostream> 5 #include <queue> 6 #define MAX 9999999 7 8 using namespace std
阅读全文
摘要:1 #include<cstdio> 2 #include<iostream> 3 #include<algorithm> 4 #include<queue> 5 #include<cstring> 6 #define MAX 9999999 7 8 using namespace std; 9 1
阅读全文