最长公共子序列。

#pragma comment(linker, "/STACK:1024000000,1024000000")
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<iostream>
using namespace std;
typedef long long LL;
const double pi=acos(-1.0),eps=1e-;
void File()
{
freopen("D:\\in.txt","r",stdin);
freopen("D:\\out.txt","w",stdout);
}
inline int read()
{
char c = getchar(); while(!isdigit(c)) c = getchar();
int x = ;
while(isdigit(c)) { x = x * + c - ''; c = getchar(); }
return x;
} const int maxn=;
char s[maxn],t[maxn];
int dp[maxn][maxn]; int main()
{
while(~scanf("%s%s",s,t))
{
memset(dp,,sizeof dp);
int lens=strlen(s),lent=strlen(t),ans=;
for(int i=;i<lens;i++)
{
for(int j=;j<lent;j++)
{
if(s[i]==t[j]) dp[i+][j+]=dp[i][j]+;
else dp[i+][j+]=max(dp[i][j+],dp[i+][j]);
ans=max(dp[i+][j+],ans);
}
}
printf("%d\n",ans);
}
return ;
}

FZU 1502 Letter Deletion的更多相关文章

  1. FZU 1502 Letter Deletion(DP)

    Description You are given two words (each word consists of upper-case English letters). Try to delet ...

  2. Soj题目分类

    -----------------------------最优化问题------------------------------------- ----------------------常规动态规划 ...

  3. FZU Problem 1853 Number Deletion

    Problem 1853 Number Deletion Accept: 80    Submit: 239 Time Limit: 1000 mSec    Memory Limit : 32768 ...

  4. FZU 2218 Simple String Problem(简单字符串问题)

    Description 题目描述 Recently, you have found your interest in string theory. Here is an interesting que ...

  5. FZU 2215 Simple Polynomial Problem(简单多项式问题)

    Description 题目描述 You are given an polynomial of x consisting of only addition marks, multiplication ...

  6. (KMP Next的运用) Period II -- fzu -- 1901

    http://acm.fzu.edu.cn/problem.php?pid=1901 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=703 ...

  7. [LeetCode] Letter Combinations of a Phone Number 电话号码的字母组合

    Given a digit string, return all possible letter combinations that the number could represent. A map ...

  8. FZU 2137 奇异字符串 后缀树组+RMQ

    题目连接:http://acm.fzu.edu.cn/problem.php?pid=2137 题解: 枚举x位置,向左右延伸计算答案 如何计算答案:对字符串建立SA,那么对于想双延伸的长度L,假如有 ...

  9. FZU 1914 单调队列

    题目链接:http://acm.fzu.edu.cn/problem.php?pid=1914 题意: 给出一个数列,如果它的前i(1<=i<=n)项和都是正的,那么这个数列是正的,问这个 ...

随机推荐

  1. openvpn环境搭建

    以下为服务端.客户端下载安装包,在CentOS 6.5部署,也可以找到相关下载源 openvpn-2.2.2.tar.gz,openvpn-2.1.3-install.rar,(https://git ...

  2. JavaScript Date对象更进一步

    总结分享这个近期开发解决的一个Bug. Javascript的Date对象具有容错性,会自动根据当年的日期根据设置的属性值转换,也就是说Date对象的setDate会影响setMonth,month会 ...

  3. 如何修改tomcat后台console标题(转)

    一个机器启动多个tomcat之后,分不清楚项目之间的区别,通过console口设置一下标题 tomcat控制台改名,修改方法:   1.找到tomcat\bin\catalina.bat   2.找到 ...

  4. Mysql基础知识整

    web项目部署 Java项目使用的web服务器:Tomcat.weblogic.webshare.jetty Php.python使用的web服务器:nginx.apache 搭建环境过程: 部署.发 ...

  5. My97DatePicker -- 一个功能丰富, 而且兼容 ie 6, 7的日期选择组件

    easyUI 也提供了 功能强大的日期组件, 可惜在ie 6,7,8下会报错,没有找到 addEventListener , JSON,  可能现在不想再支持低版本ie了 另外avalon也提供了 日 ...

  6. KVM设置DHCP、DNS、Gateway

    添加网卡 sudo vi /etc/network/interfaces #添加下面的配置 >>>>>>>> auto tap0 iface tap0 ...

  7. js 循环迭代定时器的执行次数和执行顺序??主要是因为js是单线程

    当定时器运行时即使每个迭代中执行的是setTimeout(.., 0),所有的回调函数依然是在循环结束后才会被执行 for语句开始赋值i=1;settimeout语句1000毫秒后把timer函数加入 ...

  8. 基础dp

    队友的建议,让我去学一学kuangbin的基础dp,在这里小小的整理总结一下吧. 首先我感觉自己还远远不够称为一个dp选手,一是这些题目还远不够,二是定义状态的经验不足.不过这些题目让我在一定程度上加 ...

  9. HDU 5758 Explorer Bo

    思维,树形$dp$. 首先选择一个度不为$0$的节点作为根节点,将树无根转有根. 这题的突破口就是要求瞬间移动的次数最少. 次数最少,必然是一个叶子节点走到另一个叶子节点,然后瞬间移动一次,再从一个叶 ...

  10. 第七十六节,css颜色和透明度,盒子阴影和轮廓,光标样式

    css颜色和透明度,盒子阴影和轮廓,光标样式 学习要点: 1.颜色和透明度 2.盒子阴影和轮廓 3.光标样式 一.颜色和透明度 颜色我们之前其实已经用的很多了,比如字体颜色.背景颜色.边框颜色.但除了 ...