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 |
Re:一种非主流的解决方法、、0ms,很简单,和大家分享一下下In Reply To:一种非主流的解决方法、、0ms,很简单,和大家分享一下下 Posted by:SWUST_smiles at 2010-08-08 21:20:16 > #include <iostream> > using namespace std; > int main() > { > int a[1001],b[1001],i,j,k,n; > cin>>n; > for(i=1;i<=n;i++) > cin>>a[i]; > k=1; > b[1]=a[1]; > for(i=2;i<=n;i++){ > if(a[i]>b[k]) b[++k]=a[i]; > else{ > j=k; > while(a[i]<=b[j]) j--; > b[j+1]=a[i]; > } > } > cout<<k<<endl; > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator