/*HDU1423 最长公共递增*/
#include <stdio.h>
#include <string.h>
#include <iostream>
using namespace std;
#define N 550
int dp[N][N];
int s[N],t[N]; int main()
{
int t1;
while(scanf("%d",&t1)!=EOF)
{
while(t1--)
{
int n,m;
scanf("%d",&n);
for(int i=;i<=n;i++)
scanf("%d",&s[i]);
scanf("%d",&m);
for(int i=;i<=m;i++)
scanf("%d",&t[i]);
memset(dp,,sizeof(dp));
int mx=;
for(int i=;i<=n;i++)
{
mx=;
for(int j=;j<=m;j++)
{
dp[i][j] = dp[i-][j];
if( s[i]>t[j])
{
mx=dp[i-][j];
}
if( s[i] == t[j] )
{
dp[i][j]=mx+;
}
}
}
mx=-;
int id;
for(int i=;i<=m;i++)
if(dp[n][i]>mx)
{
mx=dp[n][i];
}
printf("%d\n",mx);
if(t1!=) printf("\n");
}
}
return ;
}

Greatest Common Increasing Subsequence的更多相关文章

  1. HDU 1423 Greatest Common Increasing Subsequence LCIS

    题目链接: 题目 Greatest Common Increasing Subsequence Time Limit: 2000/1000 MS (Java/Others) Memory Limit: ...

  2. POJ 2127 Greatest Common Increasing Subsequence -- 动态规划

    题目地址:http://poj.org/problem?id=2127 Description You are given two sequences of integer numbers. Writ ...

  3. HDOJ 1423 Greatest Common Increasing Subsequence -- 动态规划

    题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1423 Problem Description This is a problem from ZOJ 2 ...

  4. ZOJ 2432 Greatest Common Increasing Subsequence(最长公共上升子序列+路径打印)

    Greatest Common Increasing Subsequence 题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problem ...

  5. HDU 1423 Greatest Common Increasing Subsequence(最长公共上升LCIS)

    HDU 1423 Greatest Common Increasing Subsequence(最长公共上升LCIS) http://acm.hdu.edu.cn/showproblem.php?pi ...

  6. HDU1423:Greatest Common Increasing Subsequence(LICS)

    Problem Description This is a problem from ZOJ 2432.To make it easyer,you just need output the lengt ...

  7. Greatest Common Increasing Subsequence hdu1423

    Greatest Common Increasing Subsequence Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536 ...

  8. POJ 2127 Greatest Common Increasing Subsequence

    You are given two sequences of integer numbers. Write a program to determine their common increasing ...

  9. HDUOJ ---1423 Greatest Common Increasing Subsequence(LCS)

    Greatest Common Increasing Subsequence Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536 ...

  10. POJ 1423 Greatest Common Increasing Subsequence【裸LCIS】

    链接: http://acm.hdu.edu.cn/showproblem.php?pid=1423 http://acm.hust.edu.cn/vjudge/contest/view.action ...

随机推荐

  1. Keil调试程序如何查看变量

    第一个问题:调试时候想实时查看某一变量变化? view 菜单下的 watch windows,全局变量才能查看 比如要查看u8 adcx的值变化,如下: 全速运行后,如下: 无法查看!什么问题? 该变 ...

  2. 遇到OutOfMemoryException异常了

    遇到OutOfMemoryException异常了 2008-11-28 09:52 asp.net做的售后服务系统运行了快1年了,昨天在做全年数据导出的时候出现OutOfMemoryExceptio ...

  3. [转发]CentOS7安装MySQL

    在CentOS中默认安装有MariaDB,这个是MySQL的分支,但为了需要,还是要在系统中安装MySQL,而且安装完成之后可以直接覆盖掉MariaDB. 1 下载并安装MySQL官方的 Yum Re ...

  4. DocumentFragment 不支持 innerHTML

    在需要多次使用 innerHTML 的地方,一般是推荐用 DocumentFragment 来缓存,最后一次性插入 body,从而减少浏览器的渲染,提高性能,不过最近也发现一个 bug: Docume ...

  5. js 空正则匹配任意一个位置

    看一个正则 这里明显,起到匹配作用的是 | 后的,可 | 后什么都没有,原理不知道,也没有搜到文献,只有在 Reg101 上是这样解释的, 所以得出结论: js 中,空正则匹配任意一个位置. 不过,这 ...

  6. hadoop运维问题记录

    hadoop综合问题记录 1.hdfs无法启动 错误: 2018-04-25 14:36:09,293 - Retrying after 10 seconds. Reason: Execution o ...

  7. User Login Client Identification

    w用HTTP认证首部注册用户名. HTTP The Definitive Guide Rather than passively trying to guess the identity of a u ...

  8. TCP requires two packet transfers to set up the connection before it can send data

    wHTTP重用现存连接来减少TCP建立时延. HTTP The Definitive Guide 4.2.3 TCP Connection Handshake Delays When you set ...

  9. Python中的推导式(列表推导式、字典推导式、集合推导式)

    推导式comprehensions(又称解析式),是Python的一种独有特性.推导式是可以从一个数据序列构建另一个新的数据序列的结构体. 共有三种推导,在Python2和3中都有支持: 列表(lis ...

  10. 安装串口设备驱动时遇到 Windows 无法验证此设备所需的驱动程序的数字签名。最近的硬件或软件更改安装的文件可能未正确签名或已损坏,或者可能是来自未知来源的恶意软件. 问题该如何处理?

    win7 系统直接在 cmd 命令行中输入以下语句,重启电脑后重新安装驱动即可. BCDEDIT -SET LOADOPTIONS DISABLE_INTEGRITY_CHECKS BCDEDIT - ...