y总的分析
import java.io.*;
public class Main {
static int n;
static final int N = 1010;
static int[] a = new int[N]; // 存放数据
static int[] f = new int[N]; // 存放结果
static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
public static void main(String[] args) throws IOException {
n = Integer.parseInt(in.readLine());
String[] data = in.readLine().split(" ");
for (int i = 1; i <= n; i++)
a[i] = Integer.parseInt(data[i - 1]);
int res = 0;
for (int i = 1; i <= n; i++) {
f[i] = 1; // 只有自己本身就是1
for (int j = 1; j < i; j++)
// 小于a[i] 才是以a[i]结尾的上升子序列
// 每一个小于自己的上升子序列加上1(自己)和自己原最长上升子序列比较
if (a[j] < a[i]) f[i] = Math.max(f[i], f[j] + 1);
res = Math.max(res, f[i]); // 每次更新最长子序列的最大值
}
System.out.println(res);
in.close();
}
}