Greatest Common Increasing Subsequence
/*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的更多相关文章
- HDU 1423 Greatest Common Increasing Subsequence LCIS
题目链接: 题目 Greatest Common Increasing Subsequence Time Limit: 2000/1000 MS (Java/Others) Memory Limit: ...
- POJ 2127 Greatest Common Increasing Subsequence -- 动态规划
题目地址:http://poj.org/problem?id=2127 Description You are given two sequences of integer numbers. Writ ...
- HDOJ 1423 Greatest Common Increasing Subsequence -- 动态规划
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1423 Problem Description This is a problem from ZOJ 2 ...
- ZOJ 2432 Greatest Common Increasing Subsequence(最长公共上升子序列+路径打印)
Greatest Common Increasing Subsequence 题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problem ...
- HDU 1423 Greatest Common Increasing Subsequence(最长公共上升LCIS)
HDU 1423 Greatest Common Increasing Subsequence(最长公共上升LCIS) http://acm.hdu.edu.cn/showproblem.php?pi ...
- 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 ...
- Greatest Common Increasing Subsequence hdu1423
Greatest Common Increasing Subsequence Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536 ...
- POJ 2127 Greatest Common Increasing Subsequence
You are given two sequences of integer numbers. Write a program to determine their common increasing ...
- HDUOJ ---1423 Greatest Common Increasing Subsequence(LCS)
Greatest Common Increasing Subsequence Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536 ...
- 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 ...
随机推荐
- jqGrid排序的两种实现方式
实现方案一客户端实现排序: jqGrid属性 loadonce:true时,所有数据加载在客户端,点击列标题由jqGrid在客户端自动排序,不再从服务器取值. 参考文件:ccMxCxTjCc.js j ...
- 【SharePoint 2010】SharePoint 2010开发方面的课堂中整理有关问题
SharePoint 2010开发方面的课堂中整理有关问题陈希章 ares@xizhang.com1. 对于SharePoint的体系结构不甚清楚,觉得有点乱了解了就不会觉得乱了,请理解1) 场服务 ...
- [SharePoint 2010] 如何在小組網站內頁面上撥放影片或是音效檔
在SharePoint 2010中, 我們可以像是Youtube一樣在網頁上撥放影片或是音效檔案. 影片或音效是採取串流的方式來撥放. 也就是說我們不需要把整個檔案都下載回來才開始撥放. 點選沒多久我 ...
- ArcGIS中的 .tpk数据
转:http://blog.csdn.net/mytudousi/article/details/33347249 什么是tpk文件 tpk是ArcGIS10.1推出的一种新的数据文件类型,主要是用于 ...
- 01.ZooKeeper安装和介绍
1.ZooKeeper安装和启动 1.下载解压ZooKeeper ZooKeeper官方地址:http://zookeeper.apache.org/ 下载当前稳定版本:zookeeper-3.4.6 ...
- WEB状态码
这些状态代码表示临时的响应.客户端在收到常规响应之前,应准备接收一个或多个 1xx 响应. 100 - 继续. 101 - 切换协议. 2xx - 成功 这类状态代码表明服务器成功地接受了客户端请求. ...
- ORACLE内存结构之SGA
SGA的管理: SQL> show parameter sga NAME TYPE VALUE ---------- ...
- 剑指Offer——二叉树中和为某一值的路径
题目描述: 输入一颗二叉树和一个整数,打印出二叉树中结点值的和为输入整数的所有路径.路径定义为从树的根结点开始往下一直到叶结点所经过的结点形成一条路径. 分析: 先序遍历二叉树,找到二叉树中结点值的和 ...
- react setstate
1.prevstate参数 https://segmentfault.com/q/1010000008177874 2.不是实时渲染 http://bbs.reactnative.cn/topic/3 ...
- Spring的IOC底层实现
IOC的底层实现 续图: