###### 最长单调递增子序列

#include <stdio.h>
main()
{
int a[11], s[11], m[11];
int i, j, max;

for (i = 1; i <= 10; i++) {
printf("input number a[%d]:/n", i);
scanf("%d", &a[i]);
m[i] = 1;
s[i] = -1;
}

m[1] = 1;

for (i = 1; i <= 10; i++)
for (j = 1; j < i; j++)
if (a[j] <= a[i] && m[j] + 1 > m[i] ) {
m[i] =  m[j] + 1;
s[i] = j;
}

max = 1;
for (i = 1; i <= 10; i++)
// printf("%d/t", m[i]);
if (m[i] > m[max])
max = i;
i = max;
// printf("%d/n", i);
while (s[i] != -1) {
printf("%d/t", a[i]);
i = s[i];
}
printf("%d", a[i]);

a = [0]*11
s = [0]*11
m = [0]*11
print a
print s
print m
for i in range(1, 11):
a[i] = int(raw_input("input number a[%d]:/n" %(i)))
m[i] = 1
s[i] = -1
m[1] = 1
print a
print s
print m

for i in range(1,11):
for j in range(1, i):
if a[j] <= a[i] and m[j] + 1 > m[i]:
m[i] = m[j] + 1
s[i] = j
max = 1
for i in range(1, 11):
if m[i] > m[max]:

max = i
i = max
while s[i] != -1:
print a[i]
i = s[i]
print a[i]

#### 最长单调递增子序列的三种解法

2014-05-04 21:20:10

#### nyist oj 17 单调递增最长子序列 (动态规划经典题）

2014-08-15 11:37:23

#### 动态规划--最长单调递增子序列

2010-11-05 21:14:00

#### 单调递增最长子序列 (动态规划经典题）

2015-04-11 13:15:58

#### 动态规划题目一：最长单调递增子序列

2013-12-07 15:09:36

#### 单调递增最长子序列 O(nlogn)

2014-02-15 12:24:24

#### C++ 最长递增子序列问题

2016-11-05 16:05:59

#### 递归与动态规划---最长递增子序列问题

2017-08-13 00:03:45

#### 最长单调递增子序列 o(n^2),o(nlogn)

2016-11-17 10:56:26

#### 算法导论15.4-6 求一个n个数的序列的最长单调递增子序列 O(n*logn)

2014-10-18 21:36:05