- 浏览: 37441 次
文章分类
- 全部博客 (41)
- 卧鸟个去 (2)
- Transform (2)
- Mathmatic (9)
- Plant-Tree (7)
- Data-Struct (12)
- Red-Black-Tree (1)
- Radix-Tree (1)
- Trie (2)
- String (4)
- BST (2)
- Amazing-Union-Find-Set (1)
- HDU (27)
- OJ (32)
- BFS (3)
- Pretty-Suffix-Array (2)
- POJ (6)
- Graceful-Segment-Tree (2)
- Geometry (6)
- Priority-Queue (2)
- Dynamic-Programing (1)
- DP (3)
- LCS (1)
- Convex-Hull (2)
- Triangulation (1)
- DFS (3)
- Combinatorial-Mathematics (2)
- Big-Number (1)
- Statistic (3)
- STL (1)
- Shortest-Path (3)
- ZOJ (1)
- Leftist-Tree (1)
- Prime (1)
- Binary-Index-Tree (1)
- (1)
- Stack (1)
- SPFA (0)
- CRT (1)
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 :(
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………………
发表评论
-
HDU 1075 What Are You Talking About
2011-08-04 11:00 865What Are You Talking About Tim ... -
HDU 1058 Humble Numbers
2011-08-02 15:55 1215Humble Numbers Time Limit: 200 ... -
HDU 2095 find your present (2)
2011-08-02 16:13 813find your present (2) Time Lim ... -
HDU 1022 Train Problem I
2011-08-02 21:00 1012Train Problem I Time Limit: 20 ... -
2142 HDU box
2011-08-02 21:21 761box Time Limit: 3000/1000 MS ( ... -
HDU 2151 Worm
2011-08-01 20:48 842Worm Time Limit: 1000/1000 MS ... -
HDU 2722 Here We Go(relians) Again
2011-08-02 00:06 1025Here We Go(relians) Again Time ... -
HDU 3791 二叉搜索树
2011-08-02 14:26 1206二叉搜索树 Time Limit: 20 ... -
PKU 2352 Stars
2011-07-31 21:47 1024Stars Time Limit: 1000MS ... -
PKU 2777 Count Color
2011-07-31 21:31 793Count Color Time Limit: 1 ... -
HDU 2098 分拆素数和
2011-07-31 21:08 1061分拆素数和 Time Limit: 1000/1000 MS ... -
ZOJ 3512 Financial Fraud .
2011-07-31 20:49 1277Financial Fraud Time Limit: 3 ... -
HDU 1798 Tell me the area .
2011-07-31 20:47 1118Tell me the area Time Limit: 3 ... -
HDU 2962 Trucking .
2011-07-31 20:46 678Trucking Time Limit: 20000/100 ... -
HDU 1596 find the safest road .
2011-07-31 20:45 599find the safest road Time Limi ... -
HDU 2553 N皇后问题 .
2011-07-31 20:20 702N皇后问题 Time Limit: 2000/1000 MS ... -
HDU 1392 Surround the Trees .
2011-07-31 20:19 793Surround the Trees Time Limit: ... -
HDU 1234 开门人和关门人 .
2011-07-31 20:17 671开门人和关门人 Time Limit: 2000/1000 ... -
HDU 1316 How Many Fibs? .
2011-07-31 20:15 975How Many Fibs? Time Limit: 200 ... -
HDU 1028 Ignatius and the Princess III .
2011-07-31 20:13 753Ignatius and the Princess III ...
相关推荐
【标题】"pku.zip_PKU" 指的是一份与北京大学(Peking University, PKU)相关的压缩文件。从描述来看,这份压缩包包含了部分编程题目的代码,可能是学生或者爱好者在解决北京大学编程竞赛或课程作业时编写的。"pku"这...
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程序 解题报告
在编程竞赛的世界里,北京大学(PKU)的ACM团队以其高质量的题目和独特的解题思路闻名。"PKU-ACM.rar"这个压缩包包含了北大ACM题目的一些核心知识点,旨在帮助参赛者理解和掌握算法竞赛中的生命周期题目解法。本文将...
"pku经典题目解题报告"这一标题揭示了文件内容的核心,它表明这是一份关于北京大学(PKU)编程竞赛或算法竞赛中的经典问题的解答集。通常,这样的报告会涵盖一系列在PKU历年比赛中出现的难题,包含了解题思路、算法...
【标题】"ACM代码 之pku代码" 涉及的是在计算机科学领域中的算法竞赛编程,尤其是北京大学(Peking University, PKU)的ACM/ICPC(国际大学生程序设计竞赛)训练代码。这些代码是参赛者或教练为了准备这类竞赛而编写的,...
标题 "pku acm 一些代码" 暗示了这是一个与北京大学(Peking University, 简称PKU)的ACM(国际大学生程序设计竞赛)相关的代码集合。在这个领域,参赛者通常需要解决算法问题,编写高效且优化的代码来求解数学、逻辑...
8数码代码pku1077,300ms(哈希+广度搜索)
标题"Pku1664"很可能是指北京大学(Peking University)在某个编程竞赛或课程中的一道题目或项目,编号为1664。这道题目可能涉及到计算机科学的基础概念,尤其是算法和数据结构。描述中提到的是"Pku1664源代码",暗示...
【标题】"PKU 课件 ppt 等 灰常强大" 指的是北京大学(PKU)的课程资料,其中包括了PPT演示文稿和其他相关文档资源,这些资料质量高、内容丰富,对学习者来说具有极高的价值。"灰常强大"这一网络用语表明这些课件...
PKU 2339 Rock, Scissors, Paper 源代码
pku acm 1469 COURSES 代码 二分图的最大匹配的匈牙利算法 解题报告请访问:http://blog.csdn.net/china8848
北京大学pku2317 Questions and answers c++标程 文件名为2371.cpp
pku acm 1042 贪心法
标题中的“pku离线题库”指的是北京大学(PKU)的一个离线试题资源,意味着它可以在无网络连接的情况下供用户浏览和练习题目。这样的资源对于那些经常在没有网络环境或者希望节省流量的学生来说非常实用。 描述部分...
根据提供的信息来看,这篇文档似乎是对北京大学(PKU)在线编程平台上的题目进行了细致的分类。由于原始文本中包含了一些无法识别的字符和符号,因此我们主要基于可识别的部分来进行解读与总结。以下是对这份分类...
根据给定的文件信息,我们可以总结出北京大学(PKU)王厚峰教授关于机器学习在自然语言处理(NLP)中的应用的相关知识点。 ### 标题:PKU机器学习课件 #### 描述:机器学习资料哈哈 我觉得很好用哒,你们觉得呢 ...
此数据集用于NLP中分词训练使用,文档中的文字已经人工切分好词组,总共有65536个中国汉字组合而成
标题中的“pku1742.rar_pku 17_pku 1742 _报告及程序”表明这是一个与北京大学(Peking University, 简称PKU)相关的项目,项目编号可能是1742,内容包括了结题报告和程序代码。这个压缩包很可能是学生或研究人员提交...