文件名称:ural1297
介绍说明--下载内容均来自于网络,请自行研究使用
算法分析:将整个字符串反过来写在原字符串后面。中间用一个特殊的字符隔开,中间我用的是0,最后面我又加了一个字符1, 如果再加0 很可能会出错。(最后一个应该也可以不加),这样就把问题变为了求这个新的字符串的某两个后缀的最长公共前缀
注意:提供一组数据 zzzdzaadzzz 答案应该输出zzz,而如果不仔细的话程序可能会输入zdz,因为有可能答案前缀没有相邻,所这里就得加上一个循环判断处理。因为这个WA三次
-Algorithm analysis: the entire string in turn write back the original string. The middle separated by a special character, the middle I use 0, the last face I added a character one, if there is likely to be wrong 0. (The last one should also not), so put the problem into a request string of a new two longest common prefix suffix NOTE: to provide the answer should be a set of data zzzdzaadzzz output zzz, and if not careful, then procedures may enter zdz, because there may be no answer to the prefix is adjacent to the loop where a judge had to deal with. WA three times because of this
注意:提供一组数据 zzzdzaadzzz 答案应该输出zzz,而如果不仔细的话程序可能会输入zdz,因为有可能答案前缀没有相邻,所这里就得加上一个循环判断处理。因为这个WA三次
-Algorithm analysis: the entire string in turn write back the original string. The middle separated by a special character, the middle I use 0, the last face I added a character one, if there is likely to be wrong 0. (The last one should also not), so put the problem into a request string of a new two longest common prefix suffix NOTE: to provide the answer should be a set of data zzzdzaadzzz output zzz, and if not careful, then procedures may enter zdz, because there may be no answer to the prefix is adjacent to the loop where a judge had to deal with. WA three times because of this
(系统自动生成,下载前可以参看下载内容)
下载文件列表
ural1297.txt