Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:一种非主流的解决方法、、0ms,很简单,和大家分享一下下

Posted by w598113636 at 2012-01-15 21:39:48 on Problem 2533
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator