最长公共子序列。

#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. action 耦合方式

    //ActionContext 方式 package com.hanqi.action; import java.util.Map; import com.opensymphony.xwork2.Ac ...

  2. 一.Maven的安装和配置整理

    Maven的安装和配置 1.1安装                 进入Maven官网的下载页面:http://maven.apache.org/download.cgi选择当前最新版本:" ...

  3. c++ inline关键字的理解

    1. inline是实现修饰符,而非声明修饰符,所以应该用于实现部分的修饰(你也可以放置inline在声明,但是没有必要) 2. 所有中类中定义的函数都默认声明为inline函数,所有我们不用显示地去 ...

  4. HTML Dom操作数据表

    在QTP中有时候使用HTML Dom会带来事半功倍的效果,比如访问页面元素对象,对元素对象进行定位和获取属性值等,最近开始学HTML Dom的一些方法,属性,事件,修改等. 下面是通过HTML Dom ...

  5. net之session漫谈及分布式session解决方案

    最近一直在纠结net下分布式会话的实现,现将近日来的个人感想记录如下,如果有什么更好的解决方案请指教. 1.什么是session: Session 对象存储特定用户会话所需的属性及配置信息.这样,当用 ...

  6. Eclipse开发中GlassFish 4 重启页面不刷新

    现在项目开发用GlassFish4做服务器,测试了几个web项目出现问题,每次编辑源代码后页面不能按照最新编辑好的代码显示. 一次重新运行web项目在服务器上看到publish,点击后运行的是新编辑的 ...

  7. jsvc 以daemon方式运行tomcat

    原理: 使用jsvc来运行服务,没有了默认8005的shutdown端口: 主进程pid为1,fork 2个进程 运行方式参考:http://commons.apache.org/proper/com ...

  8. 关于centos连接mssql的问题

    今天要搬迁服务器,需要连接sqlserver,然后装了freetds之后死活就是连接不上mssql,最后才发现,原来需要配置freetds,只需要加上下面一段即可: [192.168.10.12] h ...

  9. C-Free 5.0编译失败问题解决办法

    解决关于C-Free 5.0编译时提示错误:[Error] undefined reference to `__dyn_tls_init_callback' 解决办法: 因为错误提示的路径是C:\Mi ...

  10. @@identity的用法

    问题描述:两张表,比如说A表和B表.A表中的id为自增的,B表中的id为外键,插入时不能为空. 解决办法: 用select @@identity得到上一次插入记录时自动产生的ID,将@@identit ...