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

第一次贴代码。。

Posted by taozifish at 2011-04-24 21:44:37 on Problem 2533
#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:
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