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

简短ac。。。。。。。。。。。。。

Posted by yangyangyang91 at 2011-08-07 09:07:57 on Problem 3903
#include<stdio.h>
#include<string.h>
#define ML 100001

int f[ML];
int l;

int main()
{
    int n;
    while(scanf("%d",&n)!=-1)
    {
        l=0;
        f[0]=-1000000;
        int max=f[0];
        int s;
        for(int i=0;i<n;i++)
        {
            scanf("%d",&s);
            if(s>max)
            {f[++l]=s;max=s;continue;}

            for(int j=l-1;;j--)
            if(f[j]<s)
            {f[j+1]=s;max=f[l];break;}
        }
        printf("%d\n",l);
    }
}

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