标签:body ram contain eof line man iss ogr cstring
Time Limit: 2000MS | Memory Limit: 65536K | |
Total Submissions: 32192 | Accepted: 14093 |
Description
Input
Output
Sample Input
7 1 7 3 5 9 4 8
Sample Output
4
#include<iostream> #include<cstring> using namespace std; int main() { int n; while(cin>>n) { int a[1005],b[1005]; memset(b,0,sizeof(b)); int i,j; for(i=0;i<n;i++) cin>>a[i]; for(i=0;i<n;i++) { b[i]=1; for(j=0;j<i;j++) if(a[j]<a[i]&&b[i]<b[j]+1) b[i]++; } int max=0; for(i=0;i<n;i++) if(max<b[i]) max=b[i]; cout<<max<<endl; } return 0; }
POJ 2533 Longest Ordered Subsequence DP
标签:body ram contain eof line man iss ogr cstring
原文地址:http://www.cnblogs.com/zhchoutai/p/6816135.html