DP 简单题 之 poj 1163
2014-05-08 23:03
204 查看
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; }
相关文章推荐
- poj 1163/3176 数字三角形【简单DP】
- POJ 1163 The Triangle (简单DP)
- POJ 1163 最佳路径简单DP
- poj1163 简单DP
- POJ 1163 The Triangle (简单线性dp)
- POJ 3176-Cow Bowling/POJ 1163-The Triangle(简单DP-数塔)
- DP-POJ 1163 Triangle(简单数字三角形)
- DP 简单题 之 poj 1163
- POJ 1163 The Triangle 简单DP
- poj1163——The Triangle(简单dp)
- POJ 1163 The Triangle 简单DP
- POJ 1163 The Triangle & POJ 3176 Cow Bowling(DP动态规划)
- Milking Time POJ - 3616 (简单dp)
- POJ 3140 Contestants Division (树形DP,简单)
- 简单区间dp(nyoj 746 && poj 2955)
- 简单的dp@poj(2)2479最大子段和
- poj 3920(简单dp)
- poj 1192最优连通子集(简单树形dp)
- (复习)poj 1609 简单dp
- POJ 1088 滑雪(简单的记忆化dp)