![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
ACM_字符串
文章平均质量分 64
tagyona
独立思考。不论是做题,还是人生。
展开
-
POJ 1575/ZOJ 1698(模拟)
题目链接:http://poj.org/problem?id=1575 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1698 #include #include #include #include using namespace std; int main() { string s;转载 2013-03-09 18:00:06 · 645 阅读 · 0 评论 -
POJ 2001 Shortest Prefixes
建立一颗字典树,插入单词。 然后对于某个特定的单词,将其字符挨个输出,直到某点(只有一个字符串经过),输出结束。 void q(char *str) { Trie *p=&root; int len=strlen(str); for(int i=0;i<len;i++) { int id=str[i]-'a'; p=p->next原创 2013-07-05 15:54:35 · 414 阅读 · 0 评论 -
HDU 1251 统计难题(字典树)
第一道Trie树留念。 Trie树参考资料:http://www.wutianqi.com/?p=1359 #include #include #include using namespace std; typedef struct Trie { int v; Trie *next[26]; }Trie; Trie root; void CreateTrie(char原创 2013-05-21 14:40:30 · 573 阅读 · 0 评论 -
HDU 2222 Keywords Search(AC自动机)
第一道AC自动机留念,HDU第500题留念。 学习了Just Me牛的代码风格。 #include #include #include using namespace std; const int maxn=1e6+5; char s[maxn]; struct Trie { int count; Trie *fail, *next[26]; Trie()原创 2013-05-23 10:31:20 · 587 阅读 · 0 评论 -
HDU 1671 Phone List(字典树or String)
今天学字典树写的版本: #include #include #include using namespace std; typedef struct Trie { int v; Trie *next[10]; }Trie; Trie *root; void CreateTrie(char *str) { int len=strlen(str); Trie原创 2013-05-21 15:29:56 · 499 阅读 · 0 评论 -
HDU 3746 Cyclic Nacklace(KMP最小循环节)
很久没写过KMP了,熟悉一下next数组的写法。 next[len]-len的差即是循环部分的长度。 #include #include using namespace std; const int maxn= 100000+5; char t[maxn]; int next[maxn],len; void getnext() { int j=0,k=-1; next[原创 2013-05-20 21:10:27 · 708 阅读 · 0 评论 -
HDU 2206 IP的计算(字符串处理)
字符串处理,详见代码。 #include #include #include using namespace std; const int maxn=100+5; char s[maxn]; int p[maxn];//统计.的位置 int main() { while(gets(s)!=NULL) { int cnt=0; bool fla原创 2013-04-04 21:17:42 · 923 阅读 · 0 评论 -
ZJUT 1208 排列对称串
原题链接:http://acm.zjut.edu.cn/ShowProblem.aspx?ShowID=1208 #include #include #include #include #include #include using namespace std; bool Comp(const string &s1,const string &s2) { return转载 2013-03-07 14:08:06 · 847 阅读 · 0 评论 -
ZJUT 1204 01串排序
#include #include #include #include #include using namespace std; struct Comp { bool operator ()(const string &s1,const string &s2) { if(s1.length()!=s2.length()) return s1.lengt转载 2013-03-07 13:53:39 · 818 阅读 · 0 评论 -
后缀数组学习笔记——罗穗骞倍增算法代码
http://www.cnblogs.com/staginner/archive/2012/02/02/2335600.html转载 2013-10-30 14:45:22 · 1241 阅读 · 0 评论