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)项和都是正的,那么这个数列是正的,问这个 ...
随机推荐
- 。net定时关闭excel进程
public void Application_Start() { // 在应用程序启动时运行的代码 System.Timers.Timer timer = new System.Timers.Tim ...
- 一种基于FSIM对视频编码图像质量客观评价的方法
一 为什么对视频编码图像质量客观评价 视频图像质量主观评价一般采用连续双激励质量度量法对任一观测者连续给出原始视频图像和处理过的失真图像,由观测者根据主观感知给出分值,其需针对多个视频对象进行 ...
- Jenkins中集成Gcov代码覆盖率报告
最近终于把gcov代码覆盖报告集成到jenkins中了,总算是完成工作,写篇博客总结下. 我循序渐进地用了三个工具:gcov, lcov, gcovr 这三个工具原理(其实gcovr依赖于GNU的gc ...
- cuckoo数据库变更
1.cuckoo版本升级 cuckoo默认的数据库为sqlite,默认连接方式为sqlite:///os.path.join(REPORT_ROOT, "db", "cu ...
- 支付宝支付-tp5
官方文档中第二步请求,获取签名后的订单信息,并没有说清楚需要的数据和数据的格式,这里详细说下. 1.先引入签名和验签的类 2.实例化该类,将下图方框里的数据换成你的 3.拼凑支付宝服务器端需要的数据和 ...
- caffe训练超参数
错误: caffe % ./build/tools/caffe train -solver models/finetune_flickr_style/solver.prototxt -weights ...
- angularjs的forEach使用
最近一直在写angularjs中的http后台数据交互,存在的问题就是数据传输中数据格式的问题,如何将传输过来的数据转化为自己需要的数据.当然如果你会一点后台语言的话,完全可以用在后台把数据转化为需要 ...
- 扯扯maven的蛋
同样是放在有道云笔记里,各种散乱加发霉,抽空来整理整理,分几个部分来扯扯maven. 一.Maven是啥求. Maven 为Apache 组织中的开源项目,主要服务于基于Java 平台的项目构建.依赖 ...
- 设计模式 -- 责任链模式或者叫职责链模式(Chain of Responsibility(CoR))
什么是链?前后相连,一个连接下一个,其中包括多个节点,其实责任链模式也类似,他是多个对象之间相互关联,下一个对象的操作由上一个对象关联下来,上一个对象有个方法用于指向其他对象.职责链之间的前后关系是可 ...
- POJ 2656 Unhappy Jinjin
#include <stdio.h> int main() { ) { int i, n; ; scanf("%d", &n); ) break; ; i &l ...