| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
第50题留念#include <iostream>
using namespace std;
int numb[1010];
int dp[1010];
int N;
int findMax(int op){//寻找op和N间的最大值
int max = 0;
int temp = op;
for(; op < N; op++){
if(numb[temp] < numb[op] && max < dp[op]){
max = dp[op];
}
}
return max;
}
int main(){
int i, max = 1;
cin>>N;
/*输入部分*/
for(i = 0; i < N; i++){
cin>>numb[i];
}
dp[N - 1] = 1;
for(i = N - 2; i >= 0; i--){
dp[i] = findMax(i) + 1;
max = max > dp[i] ? max : dp[i];
}
cout<<max<<endl;
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator