This is a problem from ZOJ 2432.To make it easyer,you just need output the length of the subsequence.

InputEach sequence is described with M - its length (1 <= M <= 500) and M integer numbers Ai (-2^31 <= Ai < 2^31) - the sequence itself.Outputoutput print L - the length of the greatest common increasing subsequence of both sequences.Sample Input

1

5
1 4 2 5 -12
4
-12 1 2 4

Sample Output

2

注意一下控制格式
 #include<stdio.h>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<string.h>
using namespace std; int a[];
int b[];
int dp[]; int main()
{
std::ios::sync_with_stdio(false);
cin.tie();
cout.tie();
int tt;
cin>>tt;
while(tt--)
{
memset(a,,sizeof(a));
memset(b,,sizeof(b));
memset(dp,,sizeof(dp));
int p,q;
cin>>p;
for(int i=;i<p;i++)
cin>>a[i];
cin>>q;
for(int i=;i<q;i++)
cin>>b[i];
int maxx;
for(int i=;i<p;i++)
{
maxx=;//每次都要恢复
for(int j=;j<q;j++)
{
if(a[i]>b[j])
maxx=max(dp[j],maxx);
else if(a[i]==b[j])
dp[j]=maxx+;
}
}
int ans=;
for(int i=;i<q;i++)
ans=max(ans,dp[i]);
if(tt)
cout<<ans<<endl<<endl;
else
cout<<ans<<endl;
}
return ;
}
												

HDU-1423-Greatest Common Increasing Subsequence-最长公共上升子序列【模版】的更多相关文章

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

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

  2. HDU 1423 Greatest Common Increasing Subsequence(LICS入门,只要求出最长数)

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

  3. HDU 1423 Greatest Common Increasing Subsequence LCIS

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

  4. HDU 1423 Greatest Common Increasing Subsequence(LCIS)

    Greatest Common Increasing Subsequenc Problem Description This is a problem from ZOJ 2432.To make it ...

  5. HDU 1423 Greatest Common Increasing Subsequence

    最长公共上升子序列   LCIS 看这个博客  http://www.cnblogs.com/nuoyan2010/archive/2012/10/17/2728289.html #include&l ...

  6. HDU 1423 Greatest Common Increasing Subsequence ——动态规划

    好久以前的坑了. 最长公共上升子序列. 没什么好说的,自己太菜了 #include <map> #include <cmath> #include <queue> ...

  7. HDOJ 1423 Greatest Common Increasing Subsequence 【DP】【最长公共上升子序列】

    HDOJ 1423 Greatest Common Increasing Subsequence [DP][最长公共上升子序列] Time Limit: 2000/1000 MS (Java/Othe ...

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

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

  9. 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 ...

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

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

随机推荐

  1. Nmap扫描与Tcpdump抓包分析

    扫描与抓包分析 3.1 问题 本案例要求熟悉Linux主机环境下的常用安全工具,完成以下任务操作: 使用NMAP扫描来获取指定主机/网段的相关信息 使用EtterCAP截获明文通信的密码.检测非加密通 ...

  2. 记录下工作中用到的Linux命令

    ---恢复内容开始--- 常用的Linux命令以下命令在博主的开发中经常使用,因此在此做一记录,以做备忘! 1.查看java进程ps -ef|grep javaps aux|grep java lso ...

  3. flutter 超出俩行点点点

    Text( '${listItem["title"]}', overflow: TextOverflow.ellipsis, maxLines: 2, style: TextSty ...

  4. Notepad++如何对比文件 Notepad++对比两个文件代码方法

    大家在使用Notepad++的时候,需要对编辑的两个文件进行比较,找出两个文件代码的区别,快速进行编辑修改,那么Notepad++如何对比文件,下面小编就给大家带来Notepad++对比两个文件代码方 ...

  5. Go的异常处理 defer, panic, recover

    Go语言追求简洁优雅,所以,Go语言不支持传统的 try…catch…finally 这种异常,因为Go语言的设计者们认为,将异常与控制结构混在一起会很容易使得代码变得混乱.因为开发者很容易滥用异常, ...

  6. docker 使用网络以及容器互联

    [root@docker01 /]# docker run -d -p : --name web training/webapp ####小p ,容器的5000端口随机映射到宿主机的9999端口 se ...

  7. 自动化测试工具1-testcomplete

    TestComplete是SmartBear公司开发的一套支持自动测试软件的工具.在当今的软件开发中,自动测试非常重要,大型软件开发公司很久以来就已经将其作为软件开发的一项重要环节.然而,自动测试软件 ...

  8. mybatis浅显认识

    mybatis主配置文件: <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE configu ...

  9. 数据库和java Bean

    ·1. 数据库和java Bean,字段类型要一致.不一致查询不出来,但不会报错. 字段名称也一样,不一致查询不出来,但不会报错. 2. 数据库和java Bean字段的个数可以不一样,也不会包错 3 ...

  10. 2-JDK环境变量配置和验证

    背景: 官网下载,默认路径安装,如下图,java目录下有两个文件夹:jdk和jre: 1.计算机 -> 右击 -> 属性 -> 选择左侧的'高级系统设置' 2.高级系统设置 -> ...