摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=3065View Code 1 //3065 2 #include <cstdio> 3 #include <cstring> 4 #include <cctype> 5 using namespace std; 6 7 const int N=50100,B=26; 8 int trie[N][B]; 9 int key[N],cnt[N],fail[N];10 int sz,id;11 int que[N];12 char vac[1010][60];13 char s[
阅读全文
posted @ 2012-03-28 21:09
Qiuqiqiu
阅读(132)
推荐(0)
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1255面积并View Code 1 //1255 2 #include <cstdio> 3 #include <algorithm> 4 using namespace std; 5 6 const int N=1010*2; 7 struct segment 8 { 9 double x1,x2,h; 10 int v; 11 segment(){} 12 segment(double t1,double t2,double th,double tv)...
阅读全文
posted @ 2012-03-28 18:50
Qiuqiqiu
阅读(165)
推荐(0)
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=2852View Code 1 //2852 2 #include <cstdio> 3 #include <cstring> 4 using namespace std; 5 6 const int N=100010,maxn=100000; 7 int c[N]; 8 int lowbit(int x) 9 {10 return x&(-x);11 }12 int sum(int x)13 {14 int s=0;15 for(int i=x;i>0;i-=lowbit
阅读全文
posted @ 2012-03-28 15:28
Qiuqiqiu
阅读(190)
推荐(0)
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=2227离散化+树状数组View Code 1 //2227 2 #include <cstdio> 3 #include <cstring> 4 #include <algorithm> 5 using namespace std; 6 7 const int N=100010,maxn=100000,md=1000000007; 8 int val[N],a[N]; 9 __int64 c[N];10 int lowbit(int x)11 {12 return x&am
阅读全文
posted @ 2012-03-27 20:06
Qiuqiqiu
阅读(153)
推荐(0)
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=3743离散化+树状数组View Code 1 #include <cstdio> 2 #include <cstring> 3 #include <algorithm> 4 using namespace std; 5 6 const int N=1000100,maxn=1000000; 7 int val[N],a[N],c[N]; 8 int lowbit(int x) 9 {10 return x&(-x);11 }12 int bfind(int x,in
阅读全文
posted @ 2012-03-27 18:48
Qiuqiqiu
阅读(264)
推荐(0)
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=2838View Code 1 #include <cstdio> 2 #include <cstring> 3 using namespace std; 4 5 const int N=100100,maxn=100000; 6 int ccnt[N]; 7 __int64 csum[N]; 8 int lowbit(int x) 9 {10 return x&(x^(x-1));11 }12 int main()13 {14 int n,x;15 while (~scanf(
阅读全文
posted @ 2012-03-27 15:42
Qiuqiqiu
阅读(269)
推荐(0)
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=2642View Code 1 #include <cstdio> 2 #include <cstring> 3 using namespace std; 4 5 const int N=1010,maxn=1001;; 6 char flag[N][N]; 7 int c[N][N]; 8 int lowbit(int x) 9 {10 return x&(-x);11 }12 int sum(int x,int y)13 {14 int cnt=0;15 for(int i=
阅读全文
posted @ 2012-03-26 20:57
Qiuqiqiu
阅读(207)
推荐(0)
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1556View Code 1 #include<cstdio> 2 using namespace std; 3 4 const int N=100100; 5 struct node 6 { 7 int l,r,c; 8 int m() {return (l+r)/2;} 9 }st[N*4];10 int ans[N];11 void build(int l,int r,int rt)12 {13 st[rt].l=l; st[rt].r=r; st[rt].c=0;14 ...
阅读全文
posted @ 2012-03-26 17:26
Qiuqiqiu
阅读(156)
推荐(0)
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=3374最小表示+KMPView Code 1 #include <stdio.h> 2 #include <string.h> 3 #define max(a,b) ((a)>(b)?(a):(b)) 4 #define min(a,b) ((a)<(b)?(a):(b)) 5 6 const int N=1000100; 7 char str[N],dstr[N*2],t[N*2]; 8 int fail[N]; 9 int minmaxs(const char *str
阅读全文
posted @ 2012-03-14 16:56
Qiuqiqiu
阅读(200)
推荐(0)
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1711KMPView Code 1 #include <cstdio> 2 #include <cstring> 3 using namespace std; 4 5 const int M=10010,N=1000010; 6 int a[N],b[M]; 7 int fail[M]; 8 void kmp(const int *s,int l) 9 {10 fail[0]=-1;11 int i,j=-1;12 for (i=1;i<l;i++)13 {14 ...
阅读全文
posted @ 2012-03-14 08:36
Qiuqiqiu
阅读(141)
推荐(0)