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 ...
随机推荐
- OPEN资讯
http://www.open-open.com/news/view/1f55540 随着 Android 平台市场份额的持续猛增 , 越来越多的开发者开始投入 Android 应用程序的开发大潮.如 ...
- 请问view controller scene,该如何删除
当要删除默认的view controller scene的时候,选中,按del键 注意点击中间的那个左侧按钮,打开scene列表,再选中scene,按del即可删除
- EOF的一点注记
int ch; while( (ch = getchar()) != EOF ) { putchar(ch); } 执行程序,输入:we are the,然后回车.运行结果如下: [purple@lo ...
- MyEclipse — Maven+Spring+Struts+Hibernate 整合 [学习笔记-5]
测试项目 目录结构
- MyEclipse — Maven+Spring+Struts+Hibernate 整合 [学习笔记-4]
引入Hibernate 在pom.xml中加入jar包引用 <!-- hibernate4 --> <dependency> <groupId>org.hibern ...
- 连接池和 "Timeout expired"异常
转自:博客园宁静.致远:http://www.cnblogs.com/zhangzhu/archive/2013/10/10/3361197.html 异常信息: MySql.Data.MySqlCl ...
- Useful for Android the development engineer from Github
Original:http://sysmagazine.com/posts/216591/ Many plowing on open space Github, I found assemblage ...
- hdu2024C语言合法标识符
#include<iostream> #include<stdio.h> #include<math.h> #include<stdlib.h> #in ...
- lintcode: 左填充
题目 实现一个leftpad库,如果不知道什么是leftpad可以看样例 样例 leftpad("foo", 5) >> " foo" leftpa ...
- servlet学习笔记四
Servlet 主要内容: 1)servlet初始化参数与上下文参数 2)过滤器 3)监听器一.servlet初始化参数与上下文参数 1)servlet初始化参数 把某些变量放在web.xml配置,到 ...