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 chenxuan123456789 at 2012-07-29 11:08:46 on Problem 1163
#include <stdio.h>
#define M 100+10
#define max(a,b) a>b?a:b
int dp[M][M];
int main()
{
	int n,i,j;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		getchar();
		for(j=1;j<=i;j++)
			scanf("%d",&dp[i][j]);
	}
	for(i=n-1;i>=1;i--)
	{
		for(j=1;j<=i;j++)
		dp[i][j]+=max(dp[i+1][j],dp[i+1][j+1]);
	}
	printf("%d\n",dp[1][1]);
	return 1;
}

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