poj 2533 Longest Ordered Subsequence

 
 
 
 
#include <iostream>
using namespace std;
const int N = 1000;
int data[N], dp[N];
int main(){
int i,j,n,max(1);
cin>>n;
for(i=0;i<n;i++){
   cin>>data[i];
   dp[i]=1;
}
for(i=1;i<n;i++){
   for(j=0;j<i;j++){
    if(data[j]<data[i] && dp[i]==dp[j])
     dp[i]++;
   }
   if(dp[i]>max)
    max = dp[i];
  
}
cout<<max<<endl;
system("PAUSE");
return 0;
}




你可能感兴趣的:(ini,include)