POJ 2533 Longest Ordered Subsequence 最长递增序列
|
Description A numeric sequence of ai is ordered if a1 < a2 < ... < aN. Let the subsequence of the given numeric sequence (a1, a2, ..., aN) be any sequence (ai1, ai2, ..., aiK), where 1 <= i1 < i2 < ... < iK <= N. For example, sequence (1, 7, 3, 5, 9, 4, 8) has ordered subsequences, e. g., (1, 7), (3, 4, 8) and many others. All longest ordered subsequences are of length 4, e. g., (1, 3, 5, 8).
Your program, when given the numeric sequence, must find the length of its longest ordered subsequence. Input The first line of input file contains the length of sequence N. The second line contains the elements of sequence - N integers in the range from 0 to 10000 each, separated by spaces. 1 <= N <= 1000
Output Output file must contain a single integer - the length of the longest ordered subsequence of the given sequence.
Sample Input 7 1 7 3 5 9 4 8 Sample Output 4 Source Northeastern Europe 2002, Far-Eastern Subregion
|
题目大意:求最长递增序列的长度
题解:题解写在另一篇
--------http://www.cnblogs.com/Noevon/p/5685975.html
#include <stdio.h>
], a[];
int main()
{
int i, j, n, max;
scanf("%d", &n);
;i<=n;i++)
scanf("%d", &a[i]);
a[] = ;
;i<=n;i++)
{
,j=i;j>=;j--)
if(a[i]>a[j]&&max<b[j])
max=b[j];
b[i] = max+;
}
,i=;i<=n;i++)
if(max < b[i])
max = b[i];
printf("%d\n", max);
;
}
//
POJ 2533 Longest Ordered Subsequence 最长递增序列的更多相关文章
- poj 2533 Longest Ordered Subsequence 最长递增子序列
作者:jostree 转载请注明出处 http://www.cnblogs.com/jostree/p/4098562.html 题目链接:poj 2533 Longest Ordered Subse ...
- POJ 2533 - Longest Ordered Subsequence - [最长递增子序列长度][LIS问题]
题目链接:http://poj.org/problem?id=2533 Time Limit: 2000MS Memory Limit: 65536K Description A numeric se ...
- poj 2533 Longest Ordered Subsequence 最长递增子序列(LIS)
两种算法 1. O(n^2) #include<iostream> #include<cstdio> #include<cstring> using namesp ...
- POJ 2533 Longest Ordered Subsequence(裸LIS)
传送门: http://poj.org/problem?id=2533 Longest Ordered Subsequence Time Limit: 2000MS Memory Limit: 6 ...
- POJ - 2533 Longest Ordered Subsequence与HDU - 1257 最少拦截系统 DP+贪心(最长上升子序列及最少序列个数)(LIS)
Longest Ordered Subsequence A numeric sequence of ai is ordered if a1 < a2 < ... < aN. Let ...
- 题解报告:poj 2533 Longest Ordered Subsequence(最长上升子序列LIS)
Description A numeric sequence of ai is ordered if a1 < a2 < ... < aN. Let the subsequence ...
- POJ 2533 Longest Ordered Subsequence(最长上升子序列(NlogN)
传送门 Description A numeric sequence of ai is ordered if a1 < a2 < ... < aN. Let the subseque ...
- POJ 2533 Longest Ordered Subsequence(DP 最长上升子序列)
Longest Ordered Subsequence Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 38980 Acc ...
- POJ 2533 Longest Ordered Subsequence(LIS模版题)
Longest Ordered Subsequence Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 47465 Acc ...
随机推荐
- ligerui+json_002_Grid用法、属性总结
原文更全面,地址: http://blog.csdn.net/dxnn520/article/details/8216560 // ================================== ...
- struts_23_xwork校验器列表使用例子
required 必填校验器 <field-validator type="required"> <message>性别不能为空!</message& ...
- 反射认识_02_反射成员变量Field
包01: package ReflectionConstructor; public class ReflectionFieldPoint { private int x; public int y; ...
- nginx在windwos中的使用
本文章参考了 nginx for windows的介绍:http://nginx.org/en/docs/windows.html 你从官网上下载到的是一个 zip 格式的压缩包,首先要把压缩包解压. ...
- 白盒测试的学习之路----(四)搭建测试框架TestNG测试
TestNG是一个开源自动化测试框架; TestNG是类似于JUnit,但它不是一个JUnit扩展.它的灵感来源于JUnit.它的目的是优于JUnit的,尤其是当测试集成的类. TestNG消除了大部 ...
- Server2003系统上的内置服务器设置某类IP无法访问问题
最近测试过程中遇到了一个很奇怪的现象,把服务器(测试产品)部署在Server2003系统的外网A上,把客户端(测试产品)部署在内网B,网络A,B用路由器相连,设置网络A为200.1.1.255,发现客 ...
- 6lowpan
6lowpan的产品太少,到是蓝牙smart的产品现在很多.下一步就要研究6lowpan的协议了,买了一套TI的开发套件,IBM也在卖一套6lowpan的开发套件,价格还挺贵的,带了很多sensor, ...
- Elasticsearch--Date math在索引中的使用
在Elasticsearch,有时要通过索引日期来筛选某段时间的数据,这时就要用到ES提供的日期数学表达式 描述: 特别在日志数据中,只是查询一段时间内的日志数据,这时就可以使用日期数学表达式,这样可 ...
- Office 2007在安装过程中出错-解决办法
1, 可能是因为c:\program files\common files\microsoft Shared\web server Extensions\40\bin目录下缺少Fp4autl.dll, ...
- 由于 add 运算符中“Chinese_PRC_CI_AS”和“Chinese_PRC_CS_AS_WS”之间的排序规则冲突
有一个字段的排序规则是 Chinese_PRC_CS_AS_WS,字符串连接的时候报错. 处理方案 cast(columnName as varbinary) 即可