Longest Ordered Subsequence DescriptionA 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…
题目链接:http://poj.org/problem?id=3176 思路分析:基本的DP题目:将每个节点视为一个状态,记为B[i][j], 状态转移方程为 B[i][j] = A[i][j] + Max( B[i+1][j], B[i+1][j+1] ); 代码如下: #include <stdio.h> + ; int A[MAX_N][MAX_N], B[MAX_N][MAX_N]; int Max( int a, int b ) { return a > b ? a : b;…
## Sublime Text 3 Serial key build is 3176 > * Added these lines into /etc/hosts 127.0.0.1 www.sublimetext.com 127.0.0.1 license.sublimehq.com 命令行 sodu vim /etc/hosts,添加这两行,esc,输入:wq,完事. > * Used the license key ----- BEGIN LICENSE ----- sgbteam Sin…
POJ2533裸的LIS,时间复杂度为O(n^2) #include<iostream> #include<cstdio> using namespace std; +; int a[MAXN]; int dp[MAXN]; int n,ans; int main() { scanf("%d",&n); ;i<n;i++) { scanf("%d",&a[i]); dp[i]=; } ans=-; ;i<n;i++…