标签:大数 题意 miss plm roman i++ main art show
Time Limit: 1000MS | Memory Limit: 10000K | |
Total Submissions: 41169 | Accepted: 24882 |
Description
7 3 8 8 1 0 2 7 4 4 4 5 2 6 5 (Figure 1)
Input
Output
Sample Input
5 7 3 8 8 1 0 2 7 4 4 4 5 2 6 5
Sample Output
30
Source
#include<iostream> #include<algorithm> #include<stdio.h> #include<string.h> #include<stdlib.h> #define inf 9999 #define INF -9999 using namespace std; int n; int dp[361][361]; int main() { while(scanf("%d",&n)!=EOF) { memset(dp,0,sizeof(dp)); for(int i=1;i<=n;i++) { for(int j=1;j<=i;j++) { scanf("%d",&dp[i][j]); } } for(int i=1;i<=n;i++) { for(int j=1;j<=i;j++) { dp[i][j] += max(dp[i-1][j-1],dp[i-1][j]); } } int maxx = 0; for(int i=1;i<=n;i++) { if(maxx<dp[n][i]) { maxx = dp[n][i]; } } printf("%d\n",maxx); } return 0; }
POJ 1163&& 3176 The Triangle(DP)
标签:大数 题意 miss plm roman i++ main art show
原文地址:http://www.cnblogs.com/yxysuanfa/p/6789739.html