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 |
不知道哪里错了,大家帮忙看看(WA)#include <iostream> using namespace std; void main() { int sz[1001]; int n,i; cin>>n; for (i=1;i<=n;i++) cin>>sz[i]; sz[0]=INT_MAX; int maxLen[1001]; maxLen[1]=1; int j; for (i=2;i<=n;i++) { j=i-1; while (sz[j]>=sz[i]) j--; if (j==0) maxLen[i]=1; else maxLen[i]=maxLen[j]+1; } int max=1; for (i=2;i<=n;i++) { if (max<maxLen[i]) max=maxLen[i]; } cout<<max<<endl; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator