
ACM--字符串处理
lxf90
这个作者很懒,什么都没留下…
展开
-
poj 1200 Crazy Search
题意给定一个由NC个字母组成的字符串,求长度为N的不同子串的个数思路:由于只有NC个字母,可以将字母编号,0 ~ NC - 1,转换成数字,就可以将字符串表示成NC进制的数字,这样所有字串代表的数字都是唯一的,转换成10进制的数也是唯一的!就像10的二进制表示只有1010例如 3 4daababacd = 3a = 0b = 1c = 2daa = 3 * 4 ^ 2 + 0 * 4 ^ 1 + 0 * 4 ^ 0 = 48#include #include char str[1000000];原创 2011-05-01 08:48:00 · 376 阅读 · 0 评论 -
hdu 1671 & poj 3630 Phone List
<br />基本的字典树<br />判断一组字符串中是否出现自己的前缀子串<br />#include <stdio.h> #include <string.h> const int MAXN = 100010; struct dicTree { int next[10]; bool isWord; void init(){ memset(next,-1,sizeof(next)); isWord = false; } }原创 2011-05-04 02:17:00 · 378 阅读 · 0 评论