【BZOJ 1668: [Usaco2006 Oct]Cow Pie Treasures 馅饼里的财富】基础dp

该博客介绍了如何解决BZOJ 1668题目,即在n*m的网格中,从起点到终点,每次只能向右上、右或右下移动,求最大路径和的问题。通过优先考虑按列行走来避免更新错误,采用动态规划策略解决此问题。
摘要由CSDN通过智能技术生成

BZOJ 1668
给你一个n*m的物品
然后你每次只能向右上角 右边 右下角走
问你到终点最多能收集的和
我们知道实际上就是按照他走列 所以我们优先循环列 否则会出现更新错误
这题就可以做了

/*
    if you can't see the repay
    Why not just work step by step
    rubbish is relaxed
    to ljq
*/
#include <cstdio>
#include <cstring>
#include <iostream>
#include <queue>
#include <cmath>
#include <map>
#include <stack>
#include <set>
#include <sstream>
#include <vector>
#include <stdlib.h>
#include <algorithm>
using namespace std;

#define dbg(x) cout<<#x<<" = "<< (x)<< endl
#define dbg2(x1,x2) cout<<#x1<<" = "<<x1<<" "<<#x2<<" = "<<x2<<endl
#define dbg3(x1,x2,x3) cout<<#x1<<" = "<<x1<<" "<<#x2<<" = "<<x2<<" "<<#x3<<" = "<<x3<<endl
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))

typedef pair<int,
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值