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

陈老师的题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])\),对第二维差分,\(…
[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…
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…
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…
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…
题目链接 题意: 给n长度的S串,对于0<=i<=|S|,有多少个长度为m的T串,使得LCS(S,T) = i. 思路: 理解的不是很透彻,先占个坑. #include <bits/stdc++.h> const int S = (1 << 15) + 5; const int MOD = 1e9 + 7; char color[] = "ATGC"; char s[20]; int pre[20], lcs[20]; int dp[2][S], a…