Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
1Y DP 贴代码#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator