两种求最长上升子序列问题 第一种:定义dp[i]=以a[i]为末尾的最长上升子序列问题的长度 第二种:定义dp[i]=长度为i+1的上升 子序列 中末尾元素的最小值 #include <cstdio> #include <iostream> using namespace std; const int INF = 0x3f3f3f3f; int dp[100]; int n=5; int a[]={4,2,3,1,5}; void LISone() { int res = 0; f
1.最长递增子序列模板poj2533(时间复杂度O(n*n)) #include<iostream> #include<stdio.h> #include<string.h> using namespace std; int dp[1005],a[1005]; int main() { int n; while(scanf("%d",&n)>0) { for(int i=1;i<=n;i++) scanf("%d&quo