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:郁闷死了!!!这题是不是有错啊!!!,请高手给我看一下我的算法问题出在哪

Posted by lg8t4bysq8 at 2005-11-13 16:41:11 on Problem 2533
In Reply To:郁闷死了!!!这题是不是有错啊!!!,请高手给我看一下我的算法问题出在哪 Posted by:lg8t4bysq8 at 2005-11-13 16:40:53
#include<iostream>
using namespace std;
int main()
{
	int l,a[1010],c[1010],t,p;
	cin>>l;
	for(int x=0;x<l;x++)
		c[x]=1;
	for(int i=0;i<l;i++)
		cin>>a[i];
	for(int m=0;m<l;m++)
	{
		for(int y=m+1;y<l;y++)
		{   
			    p=1;
				t=a[m];
		for(int n=y;n<l;n++)
			if(a[n]>t)
			{
				p++;
				t=a[n];
			}
            if(p>c[m]) c[m]=p;

		}

	}
     t=c[0];
	for(m=1;m<l;m++)
		if(c[m]>t)
			t=c[m];
		     cout<<t<<endl;
	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