#include <iostream>
#define N 10005
using namespace std;
int a[N],n,maxlen=1;
int f( int x)
{ int i,t,m;
if (x<=0) return 1;
m=1;
for (i=0;i<x; i++)
{ t=f(i);
if (a[x]>a[i])
{ m=max(m,t+1);
if (m>maxlen) maxlen=m;
}
}
return m;
}
int main(int argc, char *argv[])
{ int i,j;
cin>>n;
for (i=0;i<n; i++)
cin>>a[i];
f(n-1);
cout<<maxlen<<endl;
return 0;
}
#include <iostream>
#define N 10005
using namespace std;
int a[N],n,maxlen=1;
int f( int x)
{ int i,t,m;
// if (x<=0) return 1;
m=1;
for (i=0;i<x; i++)
{ t=f(i);
if (a[x]>a[i])
{ m=max(m,t+1);
if (m>maxlen) maxlen=m;
}
}
return m;
}
int main(int argc, char *argv[])
{ int i,j;
cin>>n;
for (i=0;i<n; i++)
cin>>a[i];
f(n-1);
cout<<maxlen<<endl;
return 0;
}
poj 2533 poj 2533 普通递归超时1 2