DP 简单题 之 poj 1163
2014-05-08 23:03
344 查看
DP简单题。。。
要努力呀,虽说现在时间很紧。。。
要努力呀,虽说现在时间很紧。。。
#include <iostream> #include <cstdlib> #include <cstdio> #include <cstring> #include <algorithm> using namespace std; const int MAX_len = 102; int dp[MAX_len][MAX_len]; int n; int Solve() { 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]); //cout<<dp[i][j]<<'\t'; } //cout<<endl; } int ans = 0; for (int j=1; j<=n; j++) ans = max(ans, dp [j]); return ans; } int main() { //freopen("input.txt", "r", stdin); //freopen("output.txt", "w", stdout); scanf("%d", &n); memset(dp, 0, sizeof(dp)); for (int i=1; i<=n; i++) { for (int j=1; j<=i; j++) { scanf("%d", &dp[i][j]); } } printf("%d", Solve()); return 0; }
相关文章推荐
- poj1163 简单DP
- POJ 1163 The Triangle (简单DP)
- POJ 1163 最佳路径简单DP
- POJ 1163 The Triangle (简单线性dp)
- POJ 3176-Cow Bowling/POJ 1163-The Triangle(简单DP-数塔)
- DP-POJ 1163 Triangle(简单数字三角形)
- poj1163——The Triangle(简单dp)
- DP 简单题 之 poj 1163
- poj 1163/3176 数字三角形【简单DP】
- POJ 1163 The Triangle 简单DP
- POJ 1163 The Triangle 简单DP
- (简单) 树形dp+概率 POJ 3071 Football
- poj 2181 Jumping Cows ——简单DP
- poj-3176 Cow Bowling &&poj-1163 The Triangle && hihocoder #1037 : 数字三角形 (基础dp)
- POJ 1163: The Triangle(dp)
- POJ 2192 Zipper (简单DP)
- POJ 1260 Pearls (简单DP)
- poj 2355(简单dp)
- [DP] POJ 1163 The Triangle
- POJ_2385_Apple Catching_简单DP