bzoj3864-hdu4899-Hero meet devil】的更多相关文章

[BZOJ3864]Hero meet devil Description There is an old country and the king fell in love with a devil. The devil always asks the king to do some crazy things. Although the king used to be wise and beloved by his people. Now he is just like a boy in lo…
陈老师的题QwQ 原题链接 题目大意 有两个字符串\(S\)和\(T\)(都只能由'A','C','G','T'这四个字符组成),\(S\)已知\(T\)未知,还知道\(S\)的长度为\(m\).求满足\(Len(LCS(S,T))=L,1\leqslant L\leqslant |T|\)的\(S\)的个数 先想想若\(S\)已知怎么做.一个简单的\(DP\)就能解决,设\(dp[i][j]\)表示\(S\)到\(i\)位置,\(T\)到\(j\)位置时\(LCS\)的长度: 1.若\(S[i…
题目链接 题意 给出一个长度字符串\(T\),其中只包含四种字符\((A,C,G,T)\),需要找一个字符串\(S\),使得\(S\)的长度为\(m\),问\(S\)和\(T\)的\(lcs\)为\(0,1,2...|T|\)时,分别有多少种情况. \(|T| <= 15,m <= 1000\) 思路 考虑\(dp\)套\(dp\)(dp还能嵌套?) 先考虑已知S的情况下如何求\(lcs\) 用\(f[i][j]\)表示\(S\)到了\(i\)位置,\(T\)到了\(j\)位置,最长公共子序列…
3864: Hero meet devil 题意: 给你一个只由AGCT组成的字符串S (|S| ≤ 15),对于每个0 ≤ .. ≤ |S|,问 有多少个只由AGCT组成的长度为m(1 ≤ m ≤ 1000)的字符串T,使得\(LCS(T,S) = i\)? dp套dp! 通过一个外层的dp来计算使得另一个dp方程(子dp)最终结果为特定值的输入数. 一位一位确定子dp的输入,记录子dp的状态值 子dp: \(d(i,j)\)表示\(LCS(T[1,i],S[1,j])\),对第二维差分,\(…
https://www.lydsy.com/JudgeOnline/problem.php?id=3864 http://acm.hdu.edu.cn/showproblem.php?pid=4899 给你字符集为{A,T,G,C}的字符串,问有多少长度为m的字符串,满足其最长公共子序列长度为0,1……|S|. 太神啦,看巨佬博客吧:https://www.cnblogs.com/RabbitHu/p/BZOJ3864.html #include<cmath> #include<queu…
Description There is an old country and the king fell in love with a devil. The devil always asks the king to do some crazy things. Although the king used to be wise and beloved by his people. Now he is just like a boy in love and can’t refuse any re…
Time Limit: 8 Sec  Memory Limit: 128 MBSubmit: 397  Solved: 206[Submit][Status][Discuss] Description There is an old country and the king fell in love with a devil. The devil always asks the king to do some crazy things. Although the king used to be…
Description There is an old country and the king fell in love with a devil. The devil always asks the king to do some crazy things. Although the king used to be wise and beloved by his people. Now he is just like a boy in love and can't refuse any re…
http://www.lydsy.com/JudgeOnline/problem.php?id=3864 题意: 给你一个DNA序列,求有多少个长度为m的DNA序列和给定序列的LCS为0,1,2.... 求LCS方式:f[i][j]=max(f[i-1][j],f[i][j-1],f[i-1][j-1]*(s[i]==t[j])) 固定了i,相邻的j的f[i][j]值最多相差1 dp[i][j] 表示长度为i的DNA序列,将“f[ |S| ][j+1]是否比f[ |S| ][j] 大1” 这个状…
Problem Description There is an old country and the king fell in love with a devil. The devil always asks the king to do some crazy things. Although the king used to be wise and beloved by his people. Now he is just like a boy in love and can’t refus…