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 yeyin at 2004-04-21 13:16:50 on Problem 1163
#include <iostream.h>
#include <memory.h>
int max(int a,int b)
{
	if (a>b)
		return a;
	else
		return b;
}
int matrix[100][100];
int number=0;
int Try (int a,int b,int result)
{
	if (a==number)
	{
		result=result+matrix[a][b];
	}
	if (a<number)
	{
		result=result+matrix[a][b];
		result=+max(Try (a+1,b,result),Try (a+1,b+1,result));
	}
	return result;
}

int main()
{
	memset (matrix,0,sizeof (matrix));
	
	cin>>number;
	int a,b=0;
	for (a=0;a<number;a++)
		for (b=0;b<=a;b++)
		{
			cin>>matrix[a][b];
		}
		cout<<Try (0,0,0)<<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