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

5891MS 过!玩星际2去!!!

Posted by donkeyinacm at 2010-03-22 23:50:27 on Problem 2452
#include <iostream>
#define MAXN 50005
int v[MAXN];

int main()
{
	freopen("c:/a.txt","r",stdin);
	int n,i,j,res,maxv;
	while(scanf("%d",&n)!=EOF)
	{
		res=-1;
		for(i=0;i<n;i++)
			scanf("%d",&v[i]);
		
		for(i=0;i<n;i++)
		{
			maxv=v[i];
			for(j=i+1;j<n;j++)
				if(v[j]<=v[i])
					break;
				else if(v[j]>maxv)
				{
					maxv=v[j];
					res=res>(j-i)?res:(j-i);
				}
		}
		printf("%d\n",res);
	}
	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