标签:des blog io ar os sp for strong div
Time Limit: 2000MS | Memory Limit: 65536K | |
Total Submissions: 34440 | Accepted: 15128 |
Description
Input
Output
Sample Input
7 1 7 3 5 9 4 8
Sample Output
4
Source
#include<iostream> #include<cstdio> #include<cstring> #include<string> #include<cstdlib> #include<cmath> #include<algorithm> #include<queue> #include<vector> #include<set> using namespace std; int n,a[1005],dp[1005],ans; int main() { while(scanf("%d",&n)!=EOF) { ans=1; memset(dp,0,sizeof(dp)); for(int i=1;i<=n;i++) scanf("%d",&a[i]); for(int i=1;i<=n;i++) dp[i]=1; for(int i=2;i<=n;i++) for(int j=1;j<i;j++) if(a[j]<a[i]&&dp[i]<=dp[j]) dp[i]=dp[j]+1; for(int i=1;i<=n;i++) if(ans<dp[i]) ans=dp[i]; printf("%d\n",ans); } return 0; }
标签:des blog io ar os sp for strong div
原文地址:http://www.cnblogs.com/a972290869/p/4099611.html