#include <bits/stdc++.h> #include <vector> using namespace std; int main() { int num; while (cin >> num) { vector<int>v; int data; for (int i = 0; i < num; i++) { cin >> data; v.push_back(data); } //求解v的最长非上升子序列 int dp[num];//dp[i]代表以i结尾的最长非上升子序列 for (int i = 0; i < num; i++) dp[i] = 1; int maxl = 1; if (num == 0) maxl = 0; for (int i = 1; i < num; i++) { for (int j = 0; j < i; j++) { if (v[i] <= v[j]) { dp[i] = max(dp[i], dp[j] + 1); } maxl = max(maxl, dp[i]); } } cout << maxl << endl; } } // 64 位输出请用 printf("%lld")