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 frkstyc at 2006-02-24 19:21:03 on Problem 1032
In Reply To:麻烦帮我看下错在哪里~~本机上根本没错误啊 Posted by:hapboylin at 2006-02-24 19:18:38
> #include <iostream>
> 
> using namespace std;
> 
> int main()
> {
> 	int n,m,i,k,j,c;
> 	int max=0;
> 	int *p;
> 	cin>>n;
> 	p=new int[n];
> 	for(i=0;i<n;i++)
> 	{
> 		cin>>p[i];
> 	}
>     for(i=0;i<n;i++)
> 	{
> 		k=p[i];
> 		c=1;
> 		for(j=i;j<n;j++)
> 		{
> 			c=1;
> 			k=p[i];
> 			for(m=j+1;m<n;m++)
> 			{
> 				if(p[m]>k)
> 				{
> 					c++;
> 				    k=p[m];
> 				}
> 			}
> 		if(c>max)
> 			max=c;
> 		}
> 	}
> 	delete [] p;
> 	cout<<max<<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