最长上升子序列
2017-02-13 23:13
190 查看
#include <cstring> #include <algorithm> #include<iostream> #include<cstring> using namespace std; int main(){ int n; cin>>n; int dp[100],a[100]; fill(dp,dp+n,1); dp[0]=1; for(int i=0;i<n;i++){ cin>>a[i]; } for(int i=0;i<n;i++){ for(int j=0;j<i;j++){ if(a[j]<a[i]) dp[i]=max(dp[i],dp[j]+1); } } sort(dp,dp+n); cout<<dp[n-1]; return 0; }
相关文章推荐
- ACdream 1216 Beautiful People 二路最长上升子序列
- 最长上升子序列
- 最长上升子序列
- 最长上升子序列
- 最长上升子序列
- 最长上升子序列
- HDU 1069 Monkey and Banana dp类型:最长上升子序列
- HDU 1087 最长上升子序列
- 最长上升子序列
- 1759_最长上升子序列
- 树上最长上升子序列
- 最长上升子序列
- LintCode(M)最长上升子序列
- 动态规划练习01:最长上升子序列
- codeforce 583D Once Again... - 最长上升子序列
- POJ 3903 && 1631 &&2533 最长上升子序列
- Codeforces Round #323 (Div. 2) D LIS 最长上升子序列
- 最长上升子序列
- 最长上升子序列
- 笔记——最长上升子序列