
string字符串处理
文章平均质量分 84
qq_41818544
学会坚强,一生荣光
展开
-
C. Three Parts of the Array(切割字符串)
C. Three Parts of the ArrayYou are given an array d1,d2,…,dnd1,d2,…,dn consisting of nn integer numbers.Your task is to split this...原创 2018-08-31 15:56:56 · 322 阅读 · 0 评论 -
B. Minimum Ternary String(字符串的处理)
You are given a ternary string (it is a string which consists only of characters '0', '1' and '2').You can swap any two adjacent (consecutive) characters '0' and '1' (i.e. replace "01" with "10" or...原创 2018-08-31 20:21:40 · 360 阅读 · 0 评论 -
A. Many Equal Substrings(自己很水)
A. Many Equal SubstringsYou are given a string tt consisting of nn lowercase Latin letters and an integer number kk .Let's define a su...原创 2018-08-25 09:19:52 · 719 阅读 · 0 评论 -
string的用法
在做题中,常常会遇到字符串的处理问题,尤其是substr()截取字符串。substr(int pos, int len); pos代表索引,len代表要截取的字符串长度 #include<cstdio>#include<iostream>#include<cstring>#include<string&...原创 2018-08-25 10:36:11 · 156 阅读 · 0 评论 -
后缀自动机
自动机:由五部分组成,字符集,状态集合,初始状态,结束状态集合,状态转移函数。令 S :母串 Suf:后缀的集合 Fac:连续子串的集合 Suffix(a):从位置a开始的后缀为Suffix(a) S[l,r):表示S中[l,r)这个区间构成的子串 ST(s) != null:表示一个字符串s不属于Fac trans(s, ch):...原创 2019-07-31 09:42:32 · 126 阅读 · 0 评论 -
2019牛客第四场I题 string
链接:https://ac.nowcoder.com/acm/contest/884/I题意:求string串有多少个本质不同的子串,且这些子串之间两两不存在 a==rev(a),即不存在长度1以上的回文串题解:要算string 和 rev(string)的所有子串,对string和rev(string)建立广义后缀自动机,则理论上所有子串增加了一倍,但实际回文串和 不是回文...原创 2019-07-31 09:47:51 · 759 阅读 · 0 评论 -
回文自动机
回文树(回文自动机),他的功能如下:求前缀字符串中的本质不同的回文串种类 求每个本质不同回文串的个数 以下标为结尾的回文串个数/种类 每个本质不同回文串包含的本质不同回文串种类next[][]:类似于字典树,指向当前字符串在两段同时加上一个字符 fail[]:fail指针,类似于AC自动机,返回失配后与当前结尾的最长回文串本质上不同的最长回文后缀 cnt[]:在最后统计后它...原创 2019-08-12 16:21:16 · 137 阅读 · 0 评论