求最长升子序列<人人为我>
#include <iostream>
#include<algorithm>
using namespace std;
int main() {
const int MAXL = 1010;
int a[MAXL], maxLen[MAXL];
int n; //数组元素数
cin >> n;
for (int i = 1; i <= n; i++) {
cin >>a[i] ;
maxLen[i] = 1;
}
for(int i=2;i<=n;i++)
for (int j = 1; j < i; j++) { //计算a[i]的最长升序子序列
if (a[j] < a[i])
maxLen[i] = max(maxLen[i], maxLen[j] + 1);
}
cout << *max_element(maxLen + 1, maxLen + n + 1);
return 0;
}