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

why wrong answer ?

Posted by 2004374119 at 2010-10-07 07:44:09 on Problem 3903
#include <stdio.h>
#include <string.h>

int main()
{

	float value[100000];
	int i,j,k;
	int best[100000];
	int n;
	int result;

	freopen("A.IN","r",stdin);
	while(scanf("%d", &n)!=EOF)
	{
		if(n == 0)
		{
			printf("0\n");
			continue;
		}
		result = best[0] = 1;
		scanf("%f",&value[0]);
		for(i = 1; i < n; i++)
		{
			scanf("%f",&value[i]);
			best[i] = 1;

			for(j = 0; j <= i; j++)
			{
				if(value[i] > value[j])
					if(best[j] + 1 >= best[i])
						best[i] = best[j] + 1;

			}

			if(best[i] > result)
				result = best[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