#include<stdio.h>
int height[26];
int ans[26];
int main() {
int n;
while (scanf("%d", &n) != EOF) {
for (int i = 0; i < n; i++) {
scanf("%d", &height[i]);
ans[i] = 1;
}
for (int i = 0; i < n; i++) {
int max = 1;
for (int j = 0; j < i; j++) {
if (height[j] >= height[i])
max = max > ans[j] + 1 ? max : ans[j] + 1;
}
ans[i] = max;
}
int max = 1;
for (int i = 0; i < n; i++) {
if (ans[i] > max)
max = ans[i];
}
printf("%d\n", max);
}
return 0;
}
题目链接:
http://ac.jobdu.com/problem.php?pid=1112