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

How could this be wrong? 555

Posted by yogafrank at 2007-11-30 20:08:01 on Problem 2533
Could someone help me out? Thanks. I am.....

# include <stdio.h>

int num[1001];
int s[1001];

int main ()
{
	int n, i, j, value;

	freopen("2533.txt", "r", stdin);
	scanf ( "%d", &n );

	for ( i = 0; i < n; i++ )
	{
		s[i] = 0;
		scanf ( "%d", &num[i] );
	}

	s[0] = 1;
	for ( i = 1; i < n; i++ )
		for ( j = 0; j < i; j++)
		{
			if ( num[j] < num[i] && s[i] < s[j] + 1)
				s[i] = s[j] + 1;
		}

	value = s[0];
	for ( i = 1; i < n; i++ )
		if ( value < s[i] )
			value = s[i];
	printf ( "%d", value );
}

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