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

2533 就教为什么 这样做是WA 而;另一种是对的,谢谢大家

Posted by mabodx at 2010-02-01 17:54:54
#include<stdio.h>
#define m 1001

int main(void)
{
	int max=1,len[1001],a[1001]={0},i,j,longest=0,n;
	
	scanf("%d",&n);

	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
		for(j=0;j<i;j++)
		{
			len[i]=1;
			if(a[j]<a[i])
			{
				max=len[j]+1;
			}
			if(max>len[i])
			{
				len[i]=max;
			}
			
		}
		if(len[i]>longest)
		{
			longest=len[i];
		}
	}
	printf("%d\n",longest);
	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