POJ 2533 裸的LIS
Your program, when given the numeric sequence, must find the length of its longest ordered subsequence.
Input
Output
Sample Input
7
1 7 3 5 9 4 8
Sample Output
4
#include <iostream>
#define M 1005
using namespace std; int arr[M],dp[M],maxn;
int main()
{
int n;
while(cin>>n){
maxn = 0;
for(int i = 0; i < n; i++)
cin>>arr[i];
for(int i = 0; i < n; i++)
{
dp[i] = 1;
for(int j = 0; j < i; j++)
{
if(arr[j] < arr[i])
dp[i] = max(dp[i],dp[j]+1);
}
maxn = max(maxn,dp[i]);
} cout<<maxn<<endl;
} return 0;
}
POJ 2533 裸的LIS的更多相关文章
- POJ 2533 动态规划入门 (LIS)
Longest Ordered Subsequence Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 42914 Accepte ...
- POJ 2533 Longest Ordered Subsequence(LIS模版题)
Longest Ordered Subsequence Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 47465 Acc ...
- poj 2533 Longest Ordered Subsequence 最长递增子序列
作者:jostree 转载请注明出处 http://www.cnblogs.com/jostree/p/4098562.html 题目链接:poj 2533 Longest Ordered Subse ...
- nyoj 17-单调递增最长子序列 && poj 2533(动态规划,演算法)
17-单调递增最长子序列 内存限制:64MB 时间限制:3000ms Special Judge: No accepted:21 submit:49 题目描述: 求一个字符串的最长递增子序列的长度 如 ...
- POJ 2533 最小上升子序列
D - POJ 2533 经典DP-最长上升子序列 A numeric sequence of ai is ordered if a1 < a2 < ... < aN. Let th ...
- 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 - [最长递增子序列长度][LIS问题]
题目链接:http://poj.org/problem?id=2533 Time Limit: 2000MS Memory Limit: 65536K Description A numeric se ...
- LIS(n^2) POJ 2533 Longest Ordered Subsequence
题目传送门 题意:LIS(Longest Increasing Subsequence)裸题 分析:状态转移方程:dp[i] = max (dp[j]) + 1 (a[j] < a[i],1 ...
- POJ 2533 Longest Ordered Subsequence (LIS DP)
最长公共自序列LIS 三种模板,但是邝斌写的好像这题过不了 N*N #include <iostream> #include <cstdio> #include <cst ...
随机推荐
- 关于azkaban上传job压缩包报错问题的解决方案
在azkaban上传job压缩包如果出现 installation Failed Error Chunking during uploading files to db.. 错误,可通过如下方法解决. ...
- python -- Pythonic
所谓Pythonic,就是极具Python特色的Python代码(明显区别于其它语言的写法的代码) 总结如下: 两变量的内容交换 Python:a,b = b,a 非Python:t=a;a=b;b= ...
- windows ngix 安装 配置 使用
参考版本nginx-1.10.3 一.常用命令 start nginx.exe //开启服务 nginx.exe -s stop ...
- GraphX学习笔记——Programming Guide
学习的资料是官网的Programming Guide https://spark.apache.org/docs/latest/graphx-programming-guide.html 首先是Gra ...
- javascript转义unicode十六进制编码且带有反斜杠后的html
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- java生成txt文件,读txt文件
1.方法1 public static void main(String[] args) { try { FileWriter fileWriter = new FileWriter("c: ...
- HTTPS原理和CA证书申请(转)
原文地址:http://blog.51cto.com/11883699/2160032 众所周知,WEB服务存在http和https两种通信方式,http默认采用80作为通讯端口,对于传输采用不加密的 ...
- 用lua编写wireshark插件分析自己定义的协议
参见: https://yoursunny.com/study/IS409/ScoreBoard.htm https://wiki.wireshark.org/LuaAPI/TreeItem http ...
- react+dva+antd项目构建
一:版本升级 首先说明一下这里的dva是最新版: 2.3.2 1.初始化项目构建 npm install dva-cli -g dva -v dva-cli version 注:通过 npm 安装 d ...
- filter滤镜效果(css3属性)
<!DOCTYPE html> <html> <head> <style> img { width: 33%; height: auto; float: ...