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

简单,终于凭自己“动规”了一道,庆祝^_^

Posted by tomly at 2006-07-30 10:12:05 on Problem 1887
#include<iostream>
using namespace std;
int main()
{
	int h[33000],max,num[33000],a,i,j,test=0;
	while(cin>>a)
	{
		if(a==-1)
			break;
		test++;
		h[1]=a;
		num[1]=1;
		max=num[1];
		for(i=2;;i++)
		{
			cin>>h[i];
			num[i]=1;
			if(h[i]==-1)
				break;
			for(j=1;j<i;j++)
			{
				if(h[j]>h[i])
					if(num[j]+1>num[i])
						num[i]=num[j]+1;
			}
			if(num[i]>max)
				max=num[i];
		}
		cout<<"Test #"<<test<<":"<<endl;
		cout<<"  maximum possible interceptions: "<<max<<endl;
		cout<<endl;
	}
}

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