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 |
14行代码#include<cstdio> #include<algorithm> using namespace std; int N, dp[351][351]; int main() { scanf("%d", &N); for (int i = 1; i <= N; i++) for (int j = 1; j <= i; j++) { scanf("%d", &dp[i][j]); dp[i][j] = dp[i][j] + max(dp[i - 1][j], dp[i - 1][j - 1]); } printf("%d\n", *(max_element(dp[N], dp[N] + N + 1)) ); return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator