#include <iostream> using namespace std; const int MAXN = 25 + 10; int dp[MAXN]; int height[MAXN]; int main(){ int n; cin >> n; for (int i = 0; i < n; i++){ cin >> height[i]; } int answer = 0; for (int i = 0; i < n; i++){ dp[i] = 1; for (int j = 0; j < i; j++){ if (height[i] <= height[j]){ dp[i] = max(dp[i], dp[j] + 1); } } answer = max(answer, dp[i]); } cout << answer << endl; return 0; }
学的王道