字符串操作
爱上键盘的小哥哥
这个作者很懒,什么都没留下…
展开
-
Clairewd’s message 密文转换(扩展KMP)
Clairewd is a member of FBI. After several years concealing in BUPT, she intercepted some important messages and she was preparing for sending it to ykwd. They had agreed that each letter of these mes原创 2018-01-31 17:02:04 · 298 阅读 · 0 评论 -
Count the string
It is well known that AekdyCoin is good at string problems as well as number theory problems. When given a string s, we can write down all the non-empty prefixes of this string. For example:s: "ab原创 2018-01-29 20:30:51 · 697 阅读 · 2 评论 -
Seek the Name, Seek the Fame
The little cat is so famous, that many couples tramp over hill and dale to Byteland, and asked the little cat to give names to their newly-born babies. They seek the name, and at the same time seek th原创 2018-01-29 21:23:55 · 172 阅读 · 0 评论 -
Bellovin HDU - 5748
Peter has a sequence a1,a2,...,an and he define a function on the sequence -- F(a1,a2,...,an)=(f1,f2,...,fn), where fi is the length of the longest increasing subsequence ending with ai.原创 2018-01-30 12:07:09 · 189 阅读 · 0 评论 -
Power Strings
Given two strings a and b we define a*b to be their concatenation. For example, if a = "abc" and b = "def" then a*b = "abcdef". If we think of concatenation as multiplication, exponentiation by a non-原创 2018-01-29 18:52:30 · 623 阅读 · 0 评论 -
Hotaru's problem (马拉车算法)
Hotaru Ichijou recently is addicated to math problems. Now she is playing with N-sequence.Let's define N-sequence, which is composed with three parts and satisfied with the following condition:1.原创 2018-02-02 22:22:09 · 208 阅读 · 0 评论 -
怪盗基德的挑战书 HDU - 4552
“在树最美丽的那天,当时间老人再次把大钟平均分开时,我会降临在灯火之城的金字塔前,带走那最珍贵的笑容。”这是怪盗基德盗取巴黎卢浮宫的《蒙娜丽莎的微笑》这幅画时,挑战书上的内容。 但这次,怪盗基德的挑战书上出现了一串串小写字母“aaab sdfeeddd...”。柯南以小学生的眼睛,超凡高中生的头脑,快速统计各种字母频率,字符串长度,并结合挑战书出现的时间等信息,试图分析怪盗基德的意图...原创 2018-02-12 12:01:57 · 207 阅读 · 0 评论 -
New Distinct Substrings SPOJ - SUBST1 (后缀数组)
Given a string, we need to find the total number of its distinct substrings. Input T- number of test cases. T<=20; Each test case consists of one string, whose length is <= 50000 Out...原创 2018-02-08 12:28:34 · 185 阅读 · 0 评论 -
后缀数组
在字符串处理当中,后缀树和后缀数组都是非常有力的工具。其实后缀数组是后缀树的一个非常精巧的替代品,它比后缀树容易编程实现,能够实现后缀树的很多功能而时间复杂度也不太逊色,并且,它比后缀树所占用的空间小很多。可以说,在信息学竞赛中后缀数组比后缀树要更为实用。鉴于后缀数组的实用性,以及它的的难度,我写了这篇博文,希望能够对读者有一定的帮助。首先了解一下有关定义:1.子串:字符串str的字串sub[i....原创 2018-02-08 16:16:14 · 138 阅读 · 0 评论 -
最长对称子串(马拉车算法)
对给定的字符串,本题要求你输出最长对称子串的长度。例如,给定"Is PAT&TAP symmetric?",最长对称子串为"s PAT&TAP s",于是你应该输出11。输入格式:输入在一行中给出长度不超过1000的非空字符串。输出格式:在一行中输出最长对称子串的长度。输入样例:Is PAT&TAP symmetric?输出样例:11#include<ios...原创 2018-03-16 16:17:26 · 171 阅读 · 0 评论 -
Period (KMP)
For each prefix of a given string S with N characters (each character has an ASCII code between 97 and 126, inclusive), we want to know whether the prefix is a periodic string. That is, for each i (2原创 2018-01-29 20:07:35 · 207 阅读 · 0 评论 -
Cyclic Nacklace
CC always becomes very depressed at the end of this month, he has checked his credit card yesterday, without any surprise, there are only 99.9 yuan left. he is too distressed and thinking about how to原创 2018-01-29 18:15:33 · 143 阅读 · 0 评论 -
Blue Jeans POJ - 3080
The Genographic Project is a research partnership between IBM and The National Geographic Society that is analyzing DNA from hundreds of thousands of contributors to map how the Earth was populated.原创 2018-02-01 14:22:31 · 184 阅读 · 0 评论 -
Substrings HDU - 1238
You are given a number of case-sensitive strings of alphabetic characters, find the largest string X, such that either X, or its inverse can be found as a substring of any of the given strings.原创 2018-02-01 15:03:47 · 224 阅读 · 0 评论 -
Corporate Identity HDU - 2328
Beside other services, ACM helps companies to clearly state their “corporate identity”, which includes company logo but also other signs, like trademarks. One of such companies is Internet Building Ma原创 2018-02-01 15:54:33 · 276 阅读 · 0 评论 -
String Problem HDU - 3374(字符串的最大最小表示)
Give you a string with length N, you can generate N strings by left shifts. For example let consider the string “SKYLONG”, we can generate seven strings:String Rank SKYLONG 1 KYLONGS 2 YLONG原创 2018-02-01 20:34:19 · 227 阅读 · 0 评论 -
最长回文 (马拉车算法)
给出一个只由小写英文字符a,b,c...y,z组成的字符串S,求S中最长回文串的长度. 回文就是正反读都是一样的字符串,如aba, abba等 Input 输入有多组case,不超过120组,每组输入为一行小写英文字符a,b,c...y,z组成的字符串S 两组case之间由空行隔开(该空行不用处理) 字符串长度len Output 每一行一个整数x,对应一组case,表示该组c原创 2018-02-02 10:26:56 · 613 阅读 · 0 评论 -
Palindrome (马拉车算法)
Andy the smart computer science student was attending an algorithms class when the professor asked the students a simple question, "Can you propose an efficient algorithm to find the length of the lar原创 2018-02-02 10:37:58 · 384 阅读 · 0 评论 -
Manacher's Algorithm 马拉车算法
这个马拉车算法Manacher‘s Algorithm是用来查找一个字符串的最长回文子串的线性方法,由一个叫Manacher的人在1975年发明的,这个方法的最大贡献是在于将时间复杂度提升到了线性,这是非常了不起的。对于回文串想必大家都不陌生,就是正读反读都一样的字符串,比如 "bob", "level", "noon" 等等,那么如何在一个字符串中找出最长回文子串呢,可以以每一个字符为中心,转载 2018-02-02 09:53:15 · 387 阅读 · 0 评论 -
剪花布条(KMP算法)
一块花布条,里面有些图案,另有一块直接可用的小饰条,里面也有一些图案。对于给定的花布条和小饰条,计算一下能从花布条中尽可能剪出几块小饰条来呢?Input 输入中含有一些数据,分别是成对出现的花布条和小饰条,其布条都是用可见ASCII字符表示的,可见的ASCII字符有多少个,布条的花纹也有多少种花样。花纹条和小饰条不会超过1000个字符长。如果遇见#字符,则不再进行工作。Ou原创 2018-01-29 17:23:26 · 513 阅读 · 0 评论 -
Regular Number HDU - 5972(快速匹配+setbit)
Using regular expression to define a numeric string is a very common thing. Generally, use the shape as follows:(0|9|7) (5|6) (2) (4|5)Above regular expression matches 4 digits:The first is one of 0...原创 2018-07-22 09:54:48 · 131 阅读 · 0 评论