HDU 1423 Greatest Common Increasing Subsequence
最长公共上升子序列 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的更多相关文章
- HDU 1423 Greatest Common Increasing Subsequence(最长公共上升LCIS)
HDU 1423 Greatest Common Increasing Subsequence(最长公共上升LCIS) http://acm.hdu.edu.cn/showproblem.php?pi ...
- HDU 1423 Greatest Common Increasing Subsequence LCIS
题目链接: 题目 Greatest Common Increasing Subsequence Time Limit: 2000/1000 MS (Java/Others) Memory Limit: ...
- HDU 1423 Greatest Common Increasing Subsequence(LCIS)
Greatest Common Increasing Subsequenc Problem Description This is a problem from ZOJ 2432.To make it ...
- HDU 1423 Greatest Common Increasing Subsequence(LICS入门,只要求出最长数)
Greatest Common Increasing Subsequence Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536 ...
- HDU 1423 Greatest Common Increasing Subsequence ——动态规划
好久以前的坑了. 最长公共上升子序列. 没什么好说的,自己太菜了 #include <map> #include <cmath> #include <queue> ...
- HDOJ 1423 Greatest Common Increasing Subsequence 【DP】【最长公共上升子序列】
HDOJ 1423 Greatest Common Increasing Subsequence [DP][最长公共上升子序列] Time Limit: 2000/1000 MS (Java/Othe ...
- HDOJ 1423 Greatest Common Increasing Subsequence -- 动态规划
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1423 Problem Description This is a problem from ZOJ 2 ...
- 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 ...
- HDUOJ ---1423 Greatest Common Increasing Subsequence(LCS)
Greatest Common Increasing Subsequence Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536 ...
随机推荐
- java 驼峰命名
jstl中前台jsp页面调用对象中的属性时, 用的是小驼峰命名法. 例如:${item.createTime} 1.小驼峰式命名法(lower camel case): 第一个单字以小写字母开始,第二 ...
- ExtJs之Panel基本布局
<!DOCTYPE html> <html> <head> <title>ExtJs</title> <meta http-equiv ...
- Gvim for php 安装配置
VIM for PHP Windows 2011-05-14 11:51:51| 分类: Php|举报|字号 订阅 虽然vim本质上只是一个编辑器.但只要配合一些适当的插件,vim也能变成一 ...
- 控制台console输出信息原理理解
Eclipse控制台输出信息的控制 标签: Eclipse控制台输出信息 2015-01-02 14:11 22454人阅读 评论(1) 收藏 举报 分类: Some Tips(15) 版权声明: ...
- uchome 积分体系
一.总体流程 1):管理员在后台修改积分规则2):数据被写入数据表creditrule 中,并将数据写入缓存文件data/data_creditrule.php 中3):用户发表文章或者进行其他操作的 ...
- swift:用UITabBarController、UINavigationController、模态窗口简单的搭建一个QQ界面
搭建一个QQ界面其实是一个很简单的实现,需要几种切换视图的控制器组合一起使用,即导航控制器.标签栏控制器.模态窗口.其中,将标签栏控制器设置为window的rootViewController,因为Q ...
- AdventureWorksDW2008R2 attach: Unable to open the physical file. Operating system error 5: "5(Access is denied.)
http://stackoverflow.com/questions/26014133/adventureworksdw2008r2-attach-unable-to-open-the-physica ...
- Cadence ORCAD CAPTURE元件库介绍
Cadence ORCAD CAPTURE元件库介绍 来源:Cadence 作者:ORCAD 发布时间:2007-07-08 发表评论 Cadence OrCAD Capture 具有快捷.通用的 ...
- 关于何时view.setLayoutParams(params);
1,从view得到LayoutParams params LayoutParams params = view.getLayoutParams(); 2,可以从用params.height得到当前v ...
- dotfuscator初步
从此链接下载的http://www.uzzf.com/soft/85836.html 1.安装之前,先去控制面板将VS自带的dotfuscator卸载掉 2.关闭360安全卫士 3.安装下载的程序 安 ...