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:如何做到0毫秒的.......

Posted by mmx21 at 2009-08-11 17:06:04 on Problem 2533
In Reply To:如何做到0毫秒的....... Posted by:200730720207 at 2009-05-05 15:37:52
动态规划已经很牛B了。。。 初学。。水过。。
#include "stdio.h"
int main() 
{ 
	int i,j,n,result=-1,a[1001],c[1001];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
		c[i]=1;
	}
	for(i=0;i<n;i++)
	{
		for(j=i+1;j<n;j++)
		{
			if(a[i]<a[j])
				if(c[i]+1>c[j])
					c[j]=c[i]+1;
		}
	}
	for(i=0;i<n;i++)
		if(result<c[i])
			result=c[i];
		printf("%d\n",result);
    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