package com.zmy.LIS;
import java.util.Scanner;
public class LIS {
public static void main(String[] args) {
// int[] A = {0,1, 2, 3, -9, 3, 9, 0, 11};
int[] dp = new int[100];
int[] A = new int[100];
int n = 8;
Scanner in = new Scanner(System.in);
// 输入的数组从下标 1 开始
for (int i = 1; i <= n; i++) {
A[i] = in.nextInt();
}
int ans = -1;
for (int i = 1; i <= n; i++) {
dp[i] = 1;
for (int j = 1; j < i; j++) {
if (A[i] >= A[j] && (dp[j] + 1 > dp[i])) {
dp[i] = dp[j] + 1;
}
}
ans = Math.max(ans, dp[i]);
}
System.out.println(ans);
}
}
网友评论