ç´ æ´ã«å®è£ ãLCSé·ãä½ãããã¯å¥ã®ãã¼ã¸ãåç §ãã¦ãã ããã LCSã®ã¢ã«ã´ãªãºã ã¯ãç³»åXã®içªç®ãxiãç³»åYã®jçªç®ãyjã¨ããã¨ã i = 0 ã¾ã㯠j = 0 ã®ã¨ãã LCS(i, j) = 0 i, j > 0 ã㤠xi == yj ã®ã¨ãã LCS(i, j) = LCS(i-1, j-1) + 1 i, j > 0 ã㤠xi != yj ã®ã¨ãã LCS(i, j) = max(LCS(i-1, j), LCS(i, j-1)) ã§ãããJavaã¯é åã0ãªãªã¸ã³ãªã®ã§ããã®ã¾ã¾ç´ ç´ã«å®è£ ãã¦ãã¾ãã¨ç³»åXã¨Yã®ä¸æåç®ãä¸è´ããå ´åã§ãLCSé·ã0ã«ãªã£ã¦ãã¾ãã¾ããããã§ã¡ãã£ã¨ããªããã¼ãªå®è£ ã«ãã¦ã¿ã¾ããã public class LongestCommonSubsequence { // å®è¡ãµã³ãã« public static void main(S
{{#tags}}- {{label}}
{{/tags}}