CF346B.Lucky Common Subsequence
普及+/提高
通过率:0%
时间限制:3.00s
内存限制:512MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
In mathematics, a subsequence is a sequence that can be derived from another sequence by deleting some elements without changing the order of the remaining elements. For example, the sequence BDF is a subsequence of ABCDEF. A substring of a string is a continuous subsequence of the string. For example, BCD is a substring of ABCDEF.
You are given two strings _s_1, _s_2 and another string called virus. Your task is to find the longest common subsequence of _s_1 and _s_2, such that it doesn't contain virus as a substring.
在数学中,子序列是指通过删除某个序列中的一些元素(不改变其余元素的顺序)而得到的序列。例如,序列 BDF 是 ABCDEF 的一个子序列。字符串的子串是指该字符串的一个连续子序列。例如,BCD 是 ABCDEF 的一个子串。
给你两个字符串 s1、s2 和另一个称为 virus 的字符串。你的任务是找出 s1 和 s2 的最长公共子序列,且该子序列不包含 virus 作为其子串。
输入格式
The input contains three strings in three separate lines: _s_1, _s_2 and virus (1 ≤ |_s_1|, |_s_2|, |virus| ≤ 100). Each string consists only of uppercase English letters.
输入包含三行,每行一个字符串:s1、s2 和 virus(1 ≤ ∣s1∣, ∣s2∣, ∣virus∣ ≤ 100)。每个字符串仅由大写英文字母组成。
输出格式
Output the longest common subsequence of _s_1 and _s_2 without virus as a substring. If there are multiple answers, any of them will be accepted.
If there is no valid common subsequence, output 0.
输出字符串 s1 和 s2 的最长公共子序列,要求该子序列中不包含子串 virus。如果存在多个答案,输出任意一个即可。
如果不存在满足条件的公共子序列,则输出 0。
输入输出样例
输入#1
AJKEQSLOBSROFGZ OVGURWZLWVLUXTH OZ
输出#1
ORZ
输入#2
AA A A
输出#2
0
输入解题思路,AI测评打分。不知道怎么写?