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 574904658 at 2012-07-17 20:50:38 on Problem 1163
#include "stdio.h"
int a[102][102],n,d[102][102];
int main()
{
	int i,j;
	scanf ("%d",&n);
	for (i=1;i<=n;i++)
		  for (j=1;j<=i;j++)
		     scanf("%d",&a[i][j]);
  for (j=1;j<=n;j++) d[n][j]=a[n][j];

  for (i=n-1;i>=1;i--)
	  for (j=1;j<=i;j++)
		  d[i][j]=a[i][j]+(d[i+1][j]>d[i+1][j+1]?d[i+1][j]:d[i+1][j+1]);
	  printf ("%d\n",d[1][1]);



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