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/ ...
随机推荐
- hdu1874 畅通工程续
http://acm.hdu.edu.cn/showproblem.php?pid=1874 //标准最短路模板 //需要注意的是两点间可能有多组 //需要取最短的 #include<iostr ...
- java.util.Date和java.sql.Date的区别及应用
java.util.Date 就是在除了SQL语句的情况下面使用java.sql.Date 是针对SQL语句使用的,它只包含日期而没有时间部分它都有getTime方法返回毫秒数,自然就可以直接构建ja ...
- 欧拉工程第60题:Prime pair sets
题目链接 五个数,任意两个数的任意链接后的数还是质数 满足这个条件的最小五个数的和是多少? 结果:26033 纯暴力破解: package projecteuler51to60; import jav ...
- Python list去重及找出,统计重复项
http://bbs.chinaunix.net/thread-1680208-1-1.html 如何找出 python list 中有重复的项 http://www.cnblogs.com/feis ...
- iOS开发--数组
1.sortedArrayUsingSelector (按Key值大小对NSDictionary排序) NSMutableArray *array = [NSMutableArray arrayWit ...
- YASKAWA电机控制(2)---调试
2015 5 23 基础调试—点动 上次接线由于没有接地,导致外壳带电,非常危险. 由于上次接线端子被弄坏,这次自己重做.由于没有压线钳,只用尖嘴钳把线压近端子,有可能会松动. 接线的时候Lc1.Lc ...
- windows下python脚本程序的运行
c:\python33\python.exe c:\python33\trycoding.py
- mysql: java.sql.SQLException: Incorrect string value: '\xF0\x9F\x92\x90</...'
插入数据出现问题,因为包含了特殊字符. 现象: 插入的数据中如果含有某些特殊字符,会导致插入数据失败,例如字符串”测试**插入数据...“,在console中insert是正常的,但是使用java代码 ...
- tomcat升级问题
在本地开发使用myeclipse6.5自带tomcat,部署到服务器上是7.x,导致jsp页面无法解析. 所以想着在本地也使用tomcat7部署,myeclipse6.5不支持tomcat7.x,到网 ...
- 比微软kinect更强的视频跟踪算法--TLD跟踪算法介绍
转自:http://blog.csdn.net/carson2005/article/details/7647500 TLD(Tracking-Learning-Detection)是英国萨里大学的一 ...