`

PKU 2774 Long Long Message

阅读更多
Long Long Message
Time Limit: 4000MS   Memory Limit: 131072K
Total Submissions: 12008   Accepted: 4843
Case Time Limit: 1000MS

Description

The little cat is majoring in physics in the capital of Byterland. A piece of sad news comes to him these days: his mother is getting ill. Being worried about spending so much on railway tickets (Byterland is such a big country, and he has to spend 16 shours on train to his hometown), he decided only to send SMS with his mother.

The little cat lives in an unrich family, so he frequently comes to the mobile service center, to check how much money he has spent on SMS. Yesterday, the computer of service center was broken, and printed two very long messages. The brilliant little cat soon found out:

1. All characters in messages are lowercase Latin letters, without punctuations and spaces.
2. All SMS has been appended to each other – (i+1)-th SMS comes directly after the i-th one – that is why those two messages are quite long.
3. His own SMS has been appended together, but possibly a great many redundancy characters appear leftwards and rightwards due to the broken computer.
E.g: if his SMS is “motheriloveyou”, either long message printed by that machine, would possibly be one of “hahamotheriloveyou”, “motheriloveyoureally”, “motheriloveyouornot”, “bbbmotheriloveyouaaa”, etc.
4. For these broken issues, the little cat has printed his original text twice (so there appears two very long messages). Even though the original text remains the same in two printed messages, the redundancy characters on both sides would be possibly different.

You are given those two very long messages, and you have to output the length of the longest possible original text written by the little cat.

Background:
The SMS in Byterland mobile service are charging in dollars-per-byte. That is why the little cat is worrying about how long could the longest original text be.

Why ask you to write a program? There are four resions:
1. The little cat is so busy these days with physics lessons;
2. The little cat wants to keep what he said to his mother seceret;
3. POJ is such a great Online Judge;
4. The little cat wants to earn some money from POJ, and try to persuade his mother to see the doctor :(

Input

Two strings with lowercase letters on two of the input lines individually. Number of characters in each one will never exceed 100000.

Output

A single line with a single integer number – what is the maximum length of the original text written by the little cat.

Sample Input

yeshowmuchiloveyoumydearmotherreallyicannotbelieveit
yeaphowmuchiloveyoumydearmother

Sample Output

27

同埋HDU果题一样,呢度就吾9up啦= =

代码如下!


8584823 GZHU1006100106 2774 Accepted 5340K 1125MS C++ 2514B 2011-05-03 14:18:11

 

后缀数组好pretty………………



  


  
分享到:
评论

相关推荐

    pku.zip_PKU

    【标题】"pku.zip_PKU" 指的是一份与北京大学(Peking University, PKU)相关的压缩文件。从描述来看,这份压缩包包含了部分编程题目的代码,可能是学生或者爱好者在解决北京大学编程竞赛或课程作业时编写的。"pku"这...

    用于人体动作识别的PKU-MMD大范围数据集

    PKU-MMD contains 1076 long video sequences in 51 action categories, performed by 66 subjects in three camera views. It contains almost 20,000 action instances and 5.4 million frames in total. Our ...

    pku1000程序 解题报告

    pku1000 pku1000程序 解题报告

    pku经典题目解题报告

    "pku经典题目解题报告"这一标题揭示了文件内容的核心,它表明这是一份关于北京大学(PKU)编程竞赛或算法竞赛中的经典问题的解答集。通常,这样的报告会涵盖一系列在PKU历年比赛中出现的难题,包含了解题思路、算法...

    PKU-ACM.rar_PKU_acm 题目

    在编程竞赛的世界里,北京大学(PKU)的ACM团队以其高质量的题目和独特的解题思路闻名。"PKU-ACM.rar"这个压缩包包含了北大ACM题目的一些核心知识点,旨在帮助参赛者理解和掌握算法竞赛中的生命周期题目解法。本文将...

    ACM代码 之pku代码

    【标题】"ACM代码 之pku代码" 涉及的是在计算机科学领域中的算法竞赛编程,尤其是北京大学(Peking University, PKU)的ACM/ICPC(国际大学生程序设计竞赛)训练代码。这些代码是参赛者或教练为了准备这类竞赛而编写的,...

    pku acm 一些代码

    标题 "pku acm 一些代码" 暗示了这是一个与北京大学(Peking University, 简称PKU)的ACM(国际大学生程序设计竞赛)相关的代码集合。在这个领域,参赛者通常需要解决算法问题,编写高效且优化的代码来求解数学、逻辑...

    8数码代码pku1077

    8数码代码pku1077,300ms(哈希+广度搜索)

    pku1664

    标题"Pku1664"很可能是指北京大学(Peking University)在某个编程竞赛或课程中的一道题目或项目,编号为1664。这道题目可能涉及到计算机科学的基础概念,尤其是算法和数据结构。描述中提到的是"Pku1664源代码",暗示...

    PKU 2339 Rock, Scissors, Paper

    PKU 2339 Rock, Scissors, Paper 源代码

    pku acm 1469 COURSES 代码

    pku acm 1469 COURSES 代码 二分图的最大匹配的匈牙利算法 解题报告请访问:http://blog.csdn.net/china8848

    pku2371c++标程

    北京大学pku2317 Questions and answers c++标程 文件名为2371.cpp

    pku离线题库

    北京大学(PKU)作为国内顶尖的学府,其提供的“pku离线题库”就是这样的一个宝贵资源,它不仅支持离线使用,还允许用户在没有网络时仍然能够有效地进行题目的查阅与练习。 “pku离线题库”这个资源的设计初衷,...

    pku acm 1042

    pku acm 1042 贪心法

    很详细的PKU题目分类

    根据提供的信息来看,这篇文档似乎是对北京大学(PKU)在线编程平台上的题目进行了细致的分类。由于原始文本中包含了一些无法识别的字符和符号,因此我们主要基于可识别的部分来进行解读与总结。以下是对这份分类...

    pku_training.utf8

    此数据集用于NLP中分词训练使用,文档中的文字已经人工切分好词组,总共有65536个中国汉字组合而成

    PKU机器学习课件

    根据给定的文件信息,我们可以总结出北京大学(PKU)王厚峰教授关于机器学习在自然语言处理(NLP)中的应用的相关知识点。 ### 标题:PKU机器学习课件 #### 描述:机器学习资料哈哈 我觉得很好用哒,你们觉得呢 ...

    pku1742.rar_pku 17_pku 1742 _报告及程序

    标题中的“pku1742.rar_pku 17_pku 1742 _报告及程序”表明这是一个与北京大学(Peking University, 简称PKU)相关的项目,项目编号可能是1742,内容包括了结题报告和程序代码。这个压缩包很可能是学生或研究人员提交...

Global site tag (gtag.js) - Google Analytics