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

 #include<iostream>
#include<stdio.h>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std; int num1[],num2[],dp[][];
int main( )
{
int N,M,T; scanf("%d",&T);
while( T-- )
{
scanf("%d",&N);
for( int i = ; i <= N; i++ )scanf("%d",&num1[i]);
scanf("%d",&M);
for( int i = ; i <= M; i++ )scanf("%d",&num2[i]);
memset( dp,,sizeof(dp) );
for( int i = ; i <= N; i++ )
{
int Max = ;
for( int j = ; j <= M; j++ )
{
if( num1[i] > num2[j] && dp[i-][j] > Max )Max = dp[i-][j];
if( num1[i] == num2[j] )
dp[i][j] = Max + ;
else dp[i][j] = dp[i-][j];
}
}
int res = ;
for( int i = ; i <= M; i++ )res = max( res,dp[N][i] );
cout<<res<<endl;
if( T )puts("");
}
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 LCIS

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

  3. HDU 1423 Greatest Common Increasing Subsequence(LCIS)

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

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

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

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

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

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

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

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

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

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

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

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

随机推荐

  1. C# 设置程序开机自动运行(+注册表项)

    有时候我们需要让软件安装好了,开机自动运行,这时我们需要把启动项加载到注册表中,需要注意的时现在很多杀毒软件在其他软件更改注册表的时候会有提示,可能会阻止.下面代码包含增加启动项到注册表和删除启动项. ...

  2. ExtJs布局之border

    <!DOCTYPE html> <html> <head> <title>ExtJs</title> <meta http-equiv ...

  3. Dev 统计GridControl界面上当前选中的一行的值

    private void gridView1_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChang ...

  4. 绑定CPU

    处理器的亲和性 软亲和性(affinity) 意味着进程并不会在处理器之间频繁迁移,而 硬亲和性(affinity) 则意味着进程需要在您指定的处理器上运行. 通常 Linux 内核都可以很好地对进程 ...

  5. Android核心分析之二十四Android GDI之显示缓冲管理

    Android GDI之屏幕设备管理-动态链接库 万丈高楼从地起,从最根源的硬件帧缓冲区开始.我们知道显示FrameBuffer在系统中就是一段内存,GDI的工作就是把需要输出的内容放入到该段内存的某 ...

  6. iOS开发--轮播图

    在不少项目中,都会有图片轮播这个功能,现在网上关于图片轮播的框架层出不穷,千奇百怪,笔者根据自己的思路,用两个imageView也实现了图片轮播,这里说说笔者的主要思路以及大概步骤,具体代码请看这里, ...

  7. iOS开发--正则表达式

    目录[-] 正则表达式简单语法总结 一.什么是正则表达式 二.正则表达式的基础语法 1.字面值 2.特殊字符(元字符) (1)句号 (2)字符类([]) (3)区间符号(-) (4)取反符号(^) ( ...

  8. React表单元素的使用

    一. <!DOCTYPE html> <html lang="zh-cn"> <head> <meta charset="UTF ...

  9. Qt源代码分析

    记下好文章,慢慢看,然后加上自己心得: http://www.cnblogs.com/hicjiajia/archive/2011/08/27/2155512.html Qt源码分析之信号和槽机制ht ...

  10. Delphi对于控件的SuperClassing(封装并扩展Button,使之变成TButton)

    写博客写了这么久,但是一直不知道应该怎么样写函数之间的调用关系和执行顺序,因为不停的跳来跳去的,但是写的时候却只能顺序写调用关系,直到今天发现这种写法很不错: TButton创建窗口是在CreateW ...