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 |
第一次贴代码。。#include<iostream> using namespace std; int a[1001],dp[1001]; int main() { int n,i,j,t=0; cin>>n; for(i=0;i<n;i++) cin>>a[i]; for(i=0;i<1001;i++) dp[i]=1; for(i=1;i<n;i++) for(j=0;j<i;j++) if(a[j]<a[i]&&dp[i]<=dp[j]) dp[i]=dp[j]+1; for(i=0;i<n;i++) if(t<dp[i]) t=dp[i]; cout<<t<<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