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

1Y DP 贴代码

Posted by 476844427 at 2015-05-22 20:27:55 on Problem 1163
#include<stdio.h>
int dp[105][105],n,max=-1;
int main()
{
  scanf("%d",&n);
  for(int i=1;i<=n;i++)
   for(int j=1;j<=i;j++)
   {
    scanf("%d",&dp[i][j]);
    if(dp[i-1][j]>dp[i-1][j-1])dp[i][j]+=dp[i-1][j];
    else dp[i][j]+=dp[i-1][j-1];
    if(i==n&&max<dp[i][j])max=dp[i][j];
   }
  printf("%d",max);
  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