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

Re:1163&3176

Posted by kigoemasuga at 2017-03-07 12:11:56 on Problem 3176
In Reply To:1163&3176 Posted by:Michael112233 at 2016-05-25 13:53:28
> #include<cstdio>
> #include<cstring>
> #include<algorithm>
> using namespace std;
> 
> int main()
> {
> 	int a[355][355],dp[355][355];
> 	int n,i,j;
> 	scanf("%d",&n);
> 	for(i=0;i<n;i++)
> 	{
> 		for(j=0;j<=i;j++)
> 		    scanf("%d",&a[i][j]);
> 	}
> 	memset(dp,0,sizeof(dp));
> 	for(i=n-1;i>=0;i--)
> 	    for(j=0;j<=i;j++)
> 	        dp[i][j]=max(dp[i+1][j]+a[i][j],dp[i+1][j+1]+a[i][j]);
> 	printf("%d\n",dp[0][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