Wise cyt has got a stringSwithN(1 ≤ N ≤ 10^5 ) characters. All the characters ofSare lowercase or uppercase English letters. Now he challenges Xingxing to find out a stringTof lengthNsuch that the length of the LCS (Longest Common Subsequence) ofSandTis minimum.Talso should be consisted of lowercase or uppercase English letters only. Now it is Xingxing’s problem to find out the stringT. But you need to print the minimum length of such LCS given that Xingxing has foundTcorrectly.
问题 A: Water Problem: LCS
时间限制:2000 ms 内存限制:128 MB提交:148 解决:50
[ 提交][ 状态][ 讨论版]
题目描述
输入
Input file starts with a single integerT(1 ≤ T ≤ 50),Ttest cases following. Each of the nextTtest cases has one stringSon a line.
输出
For each case print your output in format, ‘CaseX:Y’, on a single line whereXdenotes the case number starting from 1 andYdenotes the length of the shortest possibleLCS.
样例输入
2 ab abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
样例输出
Case 1: 0 Case 2: 1
提示
Subsequence can be not constant.
한국어中文فارسیEnglishไทย
Anything about the Problems, Please Contact Admin:admin
All Copyright Reserved 2010-2024Xidian Programming Contest Online JudgeTEAM
GPL2.02003-2014HUSTOJ ProjectTEAM
Anything about the Problems, Please Contact Admin:admin
All Copyright Reserved 2010-2024Xidian Programming Contest Online JudgeTEAM
GPL2.02003-2014HUSTOJ ProjectTEAM