Qiuqiqiu  
不管道路多么崎岖坎坷,我永远不停下追逐梦想的脚步!
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 20 下一页

2012年3月14日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2896AC自动机View Code 1 #include <cstdio> 2 #include <cstring> 3 #include <algorithm> 4 using namespace std; 5 6 const int N=60010,B=128; 7 int trie[N][B]; 8 int fail[N]; 9 int key[N];10 int size,id;11 int que[N];12 char w[10010];13 int web[5] 阅读全文
posted @ 2012-03-14 07:54 Qiuqiqiu 阅读(222) 评论(0) 推荐(0) 编辑

2012年3月13日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2222AC自动机View Code #include <stdio.h>#include <string.h>const int N=250010,B=26;int trie[N][26];int fail[N];int key[N];int size;int que[N];char s[1000100];void insert(char *s){ int p=0,i; for (i=0;s[i];i++) { int c=s[i]-'a'; if (!trie[... 阅读全文
posted @ 2012-03-13 19:31 Qiuqiqiu 阅读(167) 评论(0) 推荐(0) 编辑

2012年3月12日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1251字典树View Code 1 #include <stdio.h> 2 #include <string.h> 3 4 const int N=500010; 5 struct node 6 { 7 int nex[26]; 8 int cnt; 9 }tr[N];10 int sz;11 void insert(char *s)12 {13 int k=0; tr[k].cnt++;14 int i;15 for (i=0;s[i];i++)16 {... 阅读全文
posted @ 2012-03-12 21:44 Qiuqiqiu 阅读(250) 评论(0) 推荐(1) 编辑

2012年3月7日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4135容斥原理View Code 1 #include <iostream> 2 #include <cstdio> 3 #include <cmath> 4 using namespace std; 5 int p[100],cnt; 6 long long a,b,aa,bb; 7 void pt(int n,int *p,int &c) 8 { 9 c=0;10 int i,m=(int)sqrt(n);11 for (i=2;i<=m;i++) if 阅读全文
posted @ 2012-03-07 17:09 Qiuqiqiu 阅读(240) 评论(0) 推荐(0) 编辑

2012年3月2日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1828View Code 1 #include <cstdio> 2 #include <algorithm> 3 using namespace std; 4 const int N=20100; 5 struct segtree 6 { 7 int l,r,s,c,vl,vr,vs; 8 int m() { 9 int ans=(l+r)/2;10 if (ans*2>l+r) ans--;11 return ans;12 }13 ... 阅读全文
posted @ 2012-03-02 16:47 Qiuqiqiu 阅读(153) 评论(0) 推荐(0) 编辑

2012年3月1日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1542面积并#include <cstdio>#include <algorithm>using namespace std;const int N=210;struct segment{ double x1,x2,y; int d; segment(){} segment(double _x1,double _x2,double _y,int _d) :x1(_x1),x2(_x2),y(_y),d(_d){} bool operator < (const segment... 阅读全文
posted @ 2012-03-01 22:18 Qiuqiqiu 阅读(380) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1540View Code 1 //HDU 1540 2 #include <cstdio> 3 using namespace std; 4 const int N=50010; 5 struct segtree 6 { 7 int l,r,ls,rs; 8 int m() {return (l+r)/2;} 9 int len() {return r-l+1;}10 }st[N*4];11 int des[N];12 void pushup(int rt)13 {14 in... 阅读全文
posted @ 2012-03-01 14:31 Qiuqiqiu 阅读(165) 评论(0) 推荐(0) 编辑

2012年2月29日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=33974小时AC 我要崩溃了View Code 1 //HDU 3397 2 #include <cstdio> 3 using namespace std; 4 const int N=100010; 5 struct segtree 6 { 7 int l,r,c,s0,ls0,rs0,s1,ls1,rs1,cnt; 8 int m() {return (r+l)/2;} 9 int len() {return r-l+1;} 10 void set(i... 阅读全文
posted @ 2012-02-29 16:26 Qiuqiqiu 阅读(186) 评论(0) 推荐(0) 编辑

2012年2月28日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3308View Code 1 //HDU 3308 2 #include <cstdio> 3 using namespace std; 4 const int N=100100; 5 struct segtree 6 { 7 int l,r,s,ls,rs; 8 int m() {return (l+r)/2;} 9 int len() {return r-l+1;}10 }st[N*4];11 int a[N];12 void pushup(int rt)13 {14 i... 阅读全文
posted @ 2012-02-28 22:21 Qiuqiqiu 阅读(206) 评论(0) 推荐(0) 编辑
 
摘要: http://poj.org/problem?id=3667View Code 1 #include <cstdio> 2 using namespace std; 3 const int N=50010; 4 struct segtree 5 { 6 int l,r,s,ls,rs,c; 7 int m() {return (l+r)/2;} 8 int len() {return r-l+1;} 9 void set(int x) 10 { 11 c=x; 12 if (x==0) s=ls=rs=... 阅读全文
posted @ 2012-02-28 18:02 Qiuqiqiu 阅读(147) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 20 下一页