再见
2023-11-06 17:19:51
发布于:浙江
4阅读
0回复
0点赞
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int mod = 1000000007;
ll dp[201][201];
ll s[201][201];
int main() {
dp[0][0] = 1ll;
int n, m, k;
string a,b;
cin >> n >> m >> k >> a >> b;
for (int i = 1; i <= n; i++) {
for (int j = m; j >= 1; j--) {
for (int l = k; l >= 1; l--) {
if (a[i - 1] == b[j - 1])
{
s[j][l] = s[j - 1][l] + dp[j - 1][l - 1];
}
else
{
s[j][l] = 0;
}
dp[j][l] = (dp[j][l] + s[j][l]) % mod;
}
}
}
cout << dp[m][k];
return 0;
}
这里空空如也
有帮助,赞一个