虚空终端 • 2年前
using namespace std; int q[2005]; int dp[2005];
int main() {
int n, maxx;
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> q[i];
dp[i] = 1;
}
int ans = -1;
for (int i = 0; i <= n; i++) {
dp[i] = 1;
for (int j = 1; j < i; j++)
if (dp[i] < dp[j] + 1 && q[i] >= q[j])
dp[i] = dp[j] + 1;
ans = max(ans, dp[i]);
}
cout << ans;
return 0;
}
评论:
请先登录,才能进行评论