随笔分类 - 字符串算法
摘要:Organize Your Train part II Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 8787 Accepted: 2490 Description RJ Freight, a Japanese railroad
阅读全文
摘要:适用于t[]串长度较小的情况,利用位运算一般比KMP算法快两倍以上。 用D来记录前缀的匹配情况,要使用Shift 算法,需要一个辅助表B。B 是一个字典,key 是问题域字符集中的每个字符,value 是一个n 位无符号整数,记录该字符在模式串T 的哪些位置出现。 由于D【j】表示的是T[0..J]
阅读全文
摘要:In the modern time, Search engine came into the life of everybody like Google, Baidu, etc. Wiskey also wants to bring this feature to his image retrie
阅读全文
摘要:Problem Description Clairewd is a member of FBI. After several years concealing in BUPT, she intercepted some important messages and she was preparing
阅读全文
摘要:Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 8306 Accepted: 3130 Description Doubleville, a small town in Texas, was attacked by the ali
阅读全文
摘要:Phone List Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 29416 Accepted: 8774 Description Given a list of phone numbers, determine if it
阅读全文
摘要:Andy the smart computer science student was attending an algorithms class when the professor asked the students a simple question, "Can you propose an
阅读全文
摘要:吉哥又想出了一个新的完美队形游戏! 假设有n个人按顺序站在他的面前,他们的身高分别是h[1], h[2] ... h[n],吉哥希望从中挑出一些人,让这些人形成一个新的队形,新的队形若满足以下三点要求,则就是新的完美队形: 1、挑出的人保持原队形的相对顺序不变,且必须都是在原队形中连续的; 2、左右
阅读全文
摘要:After an uphill battle, General Li won a great victory. Now the head of state decide to reward him with honor and treasures for his great exploit. One
阅读全文
摘要:For each prefix with length P of a given string S,if S[i]=S[i+P] for i in [0..SIZE(S)-p-1], then the prefix is a “period” of S. We want to all the per
阅读全文
摘要:Give you n ( n < 10000) necklaces ,the length of necklace will not large than 100,tell me How many kinds of necklaces total have.(if two necklaces can
阅读全文
摘要: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 strin
阅读全文
摘要:Beside other services, ACM helps companies to clearly state their “corporate identity”, which includes company logo but also other signs, like tradema
阅读全文
摘要: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
阅读全文
摘要: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-emp
阅读全文
摘要:Homer: Marge, I just figured out a way to discover some of the talents we weren’t aware we had. Marge: Yeah, what is it? Homer: Take me for example. I
阅读全文
摘要: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
阅读全文
摘要: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 concate
阅读全文
摘要:There is a string A. The length of A is less than 1,000,000. I rewrite it again and again. Then I got a new string: AAAAAA...... Now I cut it from two
阅读全文
摘要: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 pr
阅读全文