动态规划
#include <iostream>
using
namespace
std;
int
main()
{
int
i,j,max;
int
a[26],b[26];
int
n;
cin>>n;
for
(i = 1; i <= n; i++)
{
cin>>a[i];
}
max = 0;
for
(i = 1; i<= n; i++)
{
b[i] = 1;
for
(j = 1; j <= i - 1; j++)
{
if
(a[i] <= a[j] && b[i] < b[j] + 1)
{
b[i] = b[j] + 1;
}
}
if
(b[i] > max)
{
max = b[i];
}
}
cout<<max<<endl;
return
0;
}