题目地址:http://jobdu.sinaapp.com/problem.php?cid=1040&pid=95
C语言源码:
#include<stdio.h>int max[26];int main(){ int i,j,n,a[26],ans; while(scanf("%d",&n)!=EOF) { for(i=1;i<=n;i++) scanf("%d",&a[i]); max[1]=1; for(i=2;i<=n;i++) { max[i]=1; for(j=1;j<i;j++) { if((a[j]>=a[i])&&(max[j]+1>max[i])) max[i]=max[j]+1; } } ans=1; for(i=1;i<=n;i++) if(max[i]>ans) ans=max[i]; printf("%d\n",ans); }}