POJ 2533 LIS N2
来源:互联网 发布:淘宝宝贝描述上传图片 编辑:程序博客网 时间:2024/06/03 18:23
Description
Your program, when given the numeric sequence, must find the length of its longest ordered subsequence.
Input
Output
Sample Input
71 7 3 5 9 4 8
Sample Output
4
Source
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<vector>
#include<cmath>
#include<stdlib.h>
#include<iomanip>
#include<list>
#include<deque>
#include<map>
#include <stdio.h>
#include <queue>
#define maxn 10000+5
#define ull unsigned long long
#define ll long long
#define reP(i,n) for(i=1;i<=n;i++)
#define rep(i,n) for(i=0;i<n;i++)
#define cle(a) memset(a,0,sizeof(a))
#define mod 90001
#define PI 3.141592657
#define INF 1<<30
const ull inf = 1LL << 61;
const double eps=1e-5;
using namespace std;
bool cmp(int a,int b){
return a>b;
}
int a[1001],dp[1001];
int main()
{
//freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
int n;
while(cin>>n)
{
for(int i=1;i<=n;i++)
cin>>a[i];
a[0]=-1;
cle(dp);
int ans=-1;
for(int i=1;i<=n;i++)//4 0 1 2 3
{
for(int j=0;j<i;j++)
if(a[i]>a[j])dp[i]=max(dp[i],dp[j]+1);
ans=max(dp[i],ans);
}
cout<<ans<<endl;
}
return 0;
}
- POJ 2533 LIS N2
- poj 2533 DP(LIS)
- POJ 2533 LIS模板
- POJ 2533 LIS
- POJ-2533 裸LIS
- [DP-LIS] POJ 2533
- poj-2533-LIS模板题
- POJ 2533 Longest Ordered Subsequence 典型LIS
- POJ 2533 Longest Ordered Subsequence DP(LIS)
- poj - 2533 - Longest Ordered Subsequence(LIS)
- Poj 2533 Longest Ordered Subsequence(LIS)
- poj 2533 Longest Ordered Subsequence (LIS)
- POJ 2533 : Longest Ordered Subsequence - LIS问题
- POJ 2533 Longest Ordered Subsequence (LIS)
- POJ 2533 Longest Ordered Subsequence(LIS)
- POJ 2533 Longest Ordered Subsequence (LIS)
- POJ 2533 Longest Ordered Subsequence (LIS)
- POJ-2533Longest Ordered Subsequence(LIS)
- CF 261A. Pashmak and Garden
- stl-algorithm用法
- HDU 1505City Game
- 【问题解决】FragmentTabHost 底部菜单栏,切换Frgment时重新加载问题
- HDU 1087 Super Jumping! Jumping! Jumping!
- POJ 2533 LIS N2
- 【转载】继承(C#)
- HDU 1166 敌兵布阵
- HOJ 1876经理的烦恼
- HDU 2097Sky数
- HDU 2046骨牌铺方格(滚动数组)
- POJ 2352 Stars
- HDU-5053 the Sum of Cube
- HDU 2041