DP 简单题 之 poj 1163
来源:互联网 发布:学粤语软件 编辑:程序博客网 时间:2024/05/29 06:46
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[n][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;}
0 0
- DP 简单题 之 poj 1163
- POJ 1163 The Triangle 简单DP
- POJ 1163 最佳路径简单DP
- POJ 1163 The Triangle 简单DP
- POJ 1163 The Triangle (简单DP)
- poj 1163/3176 数字三角形【简单DP】
- poj 2411(插头DP 简单题)
- POJ 3254 状态压缩DP简单题
- POJ 3311 状态压缩DP简单题
- poj 1160 Post Office(DP简单题)
- poj 2955 Brackets dp简单题
- poj 几道简单的dp题
- POJ 2181简单DP
- POJ-2004 简单DP..
- poj 2385 简单dp
- poj 3486 简单dp
- poj 2353 简单dp
- poj-2355-简单dp
- Highcharts使用指南
- windows7下object-c编译环境的搭建
- 《Cocos2d-x游戏开发之旅》读书笔记2:学习创建游戏项目
- ubunt14.04 jd-gui
- Jquery多选框互相内容交换
- DP 简单题 之 poj 1163
- android手机reboot流程分析
- JavaScript中Web应用程序事件处理
- 栈实现行编辑器
- 字符串循环右移
- hibernate 批量保存数据
- HDU1231 最大连续子序列(动态规划)
- Linux分区
- 一劳永逸的解决tomcat中文编码request请求