codeforces 682D Alyona and Strings
#include <cstdio>
#include <iostream>
#include <ctime>
#include <vector>
#include <cmath>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <cstring>
using namespace std;
typedef long long LL;
const int N=1e3+;
const int INF=0x3f3f3f3f;
const int mod=1e9+;
int n,m,k;
int dp[N][N][][];
char a[N],b[N]; int main()
{
scanf("%d%d%d",&n,&m,&k);
scanf("%s",a+);
scanf("%s",b+);
for(int i=;i<=n;i++){
for(int j=;j<=m;j++){
if(a[i]==b[j])
for(int t=;t<=k;t++)
dp[i][j][t][]=max(dp[i-][j-][t][],dp[i-][j-][t-][])+;
for(int t=;t<=k;t++)
dp[i][j][t][]=max(max(dp[i][j-][t][],dp[i-][j][t][]),dp[i][j][t][]);
}
}
printf("%d\n",dp[n][m][k][]);
return ;
}
codeforces 682D Alyona and Strings的更多相关文章
- CodeForces 682D Alyona and Strings (四维DP)
Alyona and Strings 题目链接: http://acm.hust.edu.cn/vjudge/contest/121333#problem/D Description After re ...
- Codeforces 682D Alyona and Strings(DP)
题目大概说给两个字符串s和t,然后要求一个包含k个字符串的序列,而这个序列是两个字符串的公共子序列,问这个序列包含的字符串的总长最多是多少. 如果用DP解,考虑到问题的规模,自然这么表示状态: dp[ ...
- codeforces 682D D. Alyona and Strings(dp)
题目链接: D. Alyona and Strings time limit per test 2 seconds memory limit per test 256 megabytes input ...
- Codeforces Round #358 (Div. 2) D. Alyona and Strings dp
D. Alyona and Strings 题目连接: http://www.codeforces.com/contest/682/problem/D Description After return ...
- Codeforces Round #358 (Div. 2) D. Alyona and Strings 字符串dp
题目链接: 题目 D. Alyona and Strings time limit per test2 seconds memory limit per test256 megabytes input ...
- Codeforces 385B Bear and Strings
题目链接:Codeforces 385B Bear and Strings 记录下每一个bear的起始位置和终止位置,然后扫一遍记录下来的结构体数组,过程中用一个变量记录上一个扫过的位置,用来去重. ...
- Codeforces 482C Game with Strings(dp+概率)
题目链接:Codeforces 482C Game with Strings 题目大意:给定N个字符串,如今从中选定一个字符串为答案串,你不知道答案串是哪个.可是能够通过询问来确定, 每次询问一个位置 ...
- Codeforces E. Alyona and a tree(二分树上差分)
题目描述: Alyona and a tree time limit per test 2 seconds memory limit per test 256 megabytes input stan ...
- CF#358 D. Alyona and Strings DP
D. Alyona and Strings 题意 给出两个字符串s,t,让找出最长的k个在s,t不相交的公共子串. 思路 看了好几个题解才搞懂. 代码中有注释 代码 #include<bits/ ...
随机推荐
- hdu 1309 Loansome Car Buyer
纯粹的阅读理解题………… ;}
- 黑马程序员-- .net基础加强8之委托,事件,程序集
---------------------- ASP.Net+Android+IOS开发..Net培训.期待与您交流! ---------------------- 一.委托 ============ ...
- Android中ListView滚动时上下边界的那一抹色彩
后台实现: if (Integer.parseInt(Build.VERSION.SDK) >= 9) { listview.setOverScrollMode(View.OVER_SCROLL ...
- 58. Length of Last Word
题目: Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return t ...
- Spring IoC — 基于注解的配置
基于XML的配置,Bean定义信息和Bean实现类本身是分离的,而采用基于注解的配置方式时,Bean定义信息即通过在Bean实现类上标注注解实现. @Component:对类进行标注,Spring容器 ...
- C#ShowCursor光标的显示与隐藏
使用using System.Runtime.InteropServices; [DllImport("user32.dll" , EntryPoint = "Sho ...
- Hibernate与Jpa的关系,终于弄懂
我知道Jpa是一种规范,而Hibernate是它的一种实现.除了Hibernate,还有EclipseLink(曾经的toplink),OpenJPA等可供选择,所以使用Jpa的一个好处是,可以更换实 ...
- android完全退出应用程序
android 完全退出应用程序android android 退出应用程序, 单例模式管理Activity引自:http://www.yoyong.com/archives/199android 退 ...
- HDU 4902
数据太弱,直接让我小暴力一下就过了,一开始没注意到时间是15000MS,队友发现真是太给力了 #include <cstdio> #include <cstring> ],x[ ...
- ACM - ICPC World Finals 2013 B Hey, Better Bettor
原题下载:http://icpc.baylor.edu/download/worldfinals/problems/icpc2013.pdf 这题真心的麻烦……程序不长但是推导过程比较复杂,不太好想 ...