HBC15539Delete String题解 (每日一练:英语口语)

不可一世的小女人 初识函数 62 0
想要检验自己的编程水平?来试试全网最全C++题库,让您在挑战中不断进步。
If A′ and B meet all the above conditions, we call A′ and B is a great match.Given two string A, B and a number p, your should help Slp to find the minimum number of deleting characters to get a string A'that has a great match with B.For example, if A is ”aabbcc”, B is ”abcbc” and p is 1, Slp can delete the 2nd, the 4thcharacters to get”abcc” as A′. Then B′ is ”abcb”.So A′ and B′ has exactly 1 different location. So the answer is 2.Note that Slp may delete all characters of A.

As a acmer, Slp is always thinking of problems, and a new problem come to his mind. Given two stings A and B, one can delete some characters of A to get a new string A′ to make A′ and B become a great match. A great match of A′ and B is defined as follow: 1. A′ has length of k, B has length of m (k ≤ m). 2. Define a substring of B( B1 ,B2, ... ,Bk), as a new string B′ with the same length as A′. For example, if A′has length of 3 and B is ”abcde”, the B′ will be ”abc”. 3. There are exactly p(p is a given number) i that satisfy A′i ne  ​ =B′i. If A′ and B meet all the above conditions, we call A′ and B is a great match. Given two string A, B and a number p, your should help Slp to find the minimum number of deleting characters to get a string A' that has a great match with B. For example, if A is ”aabbcc”, B is ”abcbc” and p is 1, Slp can delete the 2nd, the 4th characters to get ”abcc” as A′. Then B′ is ”abcb”.So A′ and B′ has exactly 1 different location. So the answer is 2. Note that Slp may delete all characters of A.

HBC15539Delete String题解
(每日一练:英语口语)-第1张图片-东莞河马信息技术
(图片来源网络,侵删)

标签: HBC15539Delete String题解