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 974529 at 2011-08-22 11:05:24 on Problem 3903
#include "stdio.h"
int main()
{
	int d[100000], lengh;
	int a[100000], max;
	int i, j;
	
	while (scanf("%d",&lengh))
	{
		
		max = 1;
		for (i = 1; i <= lengh; i++)
		{
			scanf("%d",&a[i]);
		}
		
		d[1] = 1;
        for(i = 2;i<= lengh;i++)
		{   
			d[i] = 1;
			for(j = 1;j < i;j++)
			{                
				if(a[i] > a[j] && d[i] < d[j]+1)                    
					d[i] = d[j]+1; 
				
			}            
			if(d[i] > max)  max = d[i];
		}
		
		printf("%d\n",max);	
	}
	
	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