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:郁闷!为什么会一直WA,请高手指定

Posted by chengsiyu at 2010-08-07 15:06:15 on Problem 2533
In Reply To:郁闷!为什么会一直WA,请高手指定 Posted by:harvest at 2007-05-02 23:45:09
> #include<stdio.h>
> int a[1000],f[1000];
> void dp(int n)
> {
> 	int i,j,max;
>     f[1]=a[0];max=1;
> 	for(i=1;i<n;i++)
> 	{
> 		for(j=1;j<=n;j++)
> 		{
> 			if(a[i]<f[j])  { f[j]=a[j];break; }
> 			else if(a[i]>f[max]) { f[++max]=a[i];break; }	
> 		}
> 	}
> 	printf("%d\n",max);
> }
> int main()
> {
> 	int i,n;   
> 	while(scanf("%d",&n)!=EOF)
       {
> 	for(i=0;i<n;i++)
> 		scanf("%d",&a[i]);
> 	for(i=1;i<=n;i++)
> 		f[i]=0;
> 	dp(n);
         }
> 	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