FZU 1502 Letter Deletion
最长公共子序列。
#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的更多相关文章
- FZU 1502 Letter Deletion(DP)
Description You are given two words (each word consists of upper-case English letters). Try to delet ...
- Soj题目分类
-----------------------------最优化问题------------------------------------- ----------------------常规动态规划 ...
- FZU Problem 1853 Number Deletion
Problem 1853 Number Deletion Accept: 80 Submit: 239 Time Limit: 1000 mSec Memory Limit : 32768 ...
- FZU 2218 Simple String Problem(简单字符串问题)
Description 题目描述 Recently, you have found your interest in string theory. Here is an interesting que ...
- FZU 2215 Simple Polynomial Problem(简单多项式问题)
Description 题目描述 You are given an polynomial of x consisting of only addition marks, multiplication ...
- (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 ...
- [LeetCode] Letter Combinations of a Phone Number 电话号码的字母组合
Given a digit string, return all possible letter combinations that the number could represent. A map ...
- FZU 2137 奇异字符串 后缀树组+RMQ
题目连接:http://acm.fzu.edu.cn/problem.php?pid=2137 题解: 枚举x位置,向左右延伸计算答案 如何计算答案:对字符串建立SA,那么对于想双延伸的长度L,假如有 ...
- FZU 1914 单调队列
题目链接:http://acm.fzu.edu.cn/problem.php?pid=1914 题意: 给出一个数列,如果它的前i(1<=i<=n)项和都是正的,那么这个数列是正的,问这个 ...
随机推荐
- MEF 调试
此章节来自msdn. 一.一般调试方法 在 Managed Extensibility Framework (MEF) 中调试问题可能非常困难,因为潜在问题与标准应用程序中的潜在问题不同. 本主题提供 ...
- NSRange:NSMakeRange
NSRange:NSMakeRange(6, cardNo.length - 10) [cardNo stringByReplacingCharactersInRange:NSMakeRange(6, ...
- Hibernate之环境搭建
开始之前,我想先理清一个概念,即ORM是什么? ORM介绍 全称:Object/Relation Mapping,即对象/关系映射. ORM也可以理解为一种规范,具体的ORM框架可作为应用程序和数据库 ...
- js中style的属性
下面这些属性都是通过js的style来设置css.只是整理了一部分,详细的可以参考相应的学习网站,不好的地方欢迎大家拍砖. alignContent :"" 属性在弹性容器内的各项 ...
- Android:关于背景选择器Selector的item顺序
在使用背景选择器的时候,如果item的顺序不对,会导致不起作用. 1.首先背景选择器的normal选项一定要放在最后. 2.pressed的选择器应该在seclet的前面.我在使用的时候找了半天问题, ...
- C#打印
public partial class Form1 : Form { PrintDocument printDocument; StringReader lineReader = null; pub ...
- Ubuntu Git服务器搭建
1.安装git和ssh工具 apt-get install git-core openssh-server openssh-client 2.添加用户名为git的用户 useradd -m git 3 ...
- 你我公益模式系统APP开发
你我公益模式系统APP开发(微or电 158.1500.1390 小凡团队)你我公益系统开发,你我公益系统模式定制,你我公益系统开发软件,你我公益平台系统开发. 互联网世界无边无界,互联网创业者应敢于 ...
- Office在线预览及PDF在线预览的实现方式大集合
一.服务器先转换为PDF,再转换为SWF,最后通过网页加载Flash预览 微软方:利用Office2007以上版本的一个PDF插件SaveAsPDFandXPS.exe可以导出PDF文件,然后再利用免 ...
- asp.net CROSS-PAGE POSTING
有两个页面page1和page2.page1中有两个按钮 <asp:Button ID="Button1" runat="server" Text=&qu ...