题解 | #拦截导弹#
拦截导弹
http://www.nowcoder.com/practice/dad3aa23d74b4aaea0749042bba2358a
#include<iostream>
using namespace std;
int main()
{
int k,ans = 0;
int height[25]{0},dp[25];
cin >> k;
for(int i = 0;i < k;++i)
cin >> height[i];
for(int i = 0;i < k;++i){
dp[i] = 1;
for(int j = 0;j < i;++j){
if(height[j] >= height[i])
dp[i] = max(dp[j] + 1,dp[i]);
}
ans = max(ans,dp[i]);
}
cout << ans;
}