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

我的代码问题出在哪儿了。一直WS,

Posted by fanrongqi at 2011-06-22 18:02:50 on Problem 3903
#include <iostream>
using namespace std;

int f(long x[],int i,int len)
{
	int current=1;
		for (i;i<len;i++)
		{
			if (x[i]<x[i+1])
			{
				current++;
				//f(x,i+1,len,current+1);
			} 
			else
			{
				return current;
			}
		}

}

int main()
{
	long input[100000];
	long result[100000]={0};
	int len;
	long temp;

	while(cin>>len)
	{
		for (int k=0;k<len;k++)
		{
			input[k]=result[k]=-1;
		}

		for (int i=0;i<len;i++)
		{
			cin>>temp;
			input[i]=temp;
		}


		for (int j=0;j<len;j++)
		{
			result[j]=f(input,j,len);
		}
        int te=1;//result[0];
		for (int j=0;j<len;j++)
		{
			if (result[j]>te)
			{
				te=result[j];
			}
		} 
		cout<<te<<endl;
	}//while(cin>>len)
	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