一道DP题, f[i,j,k] 表示 第 k 时刻 由 1 位置 变换 j 次 到达 当前 i 棵树 注意也要维护 变换 0 次的情况。
 var i,j,k,t,w,now:longint;
tree:array[..,..] of longint;
f:array[..,..,..] of longint;
function max(a,b:longint):longint;
begin
if a>b then exit(a)
else exit(b);
end;
begin
readln(t,w);
for i:= to t do
begin
readln(now);
tree[now,i]:=;
end;
for i:= to t do
for j:= to w+i-max(i,w) do
for k:= to do
begin
if (j=) and (k<>) then begin
f[k,j,i]:=f[k,j,i-]+tree[k,i];
continue;
end
else if j= then continue;
f[k,j,i]:=max(f[k,j,i],tree[k,i]+max(f[-k,j-,i-],f[k,j,i-]));
//writeln(i,' ',j,' ',f[k,j,i]);
end;
writeln(max(f[,w,t],f[,w,t]));
end.
   (转载请注明出处:http://www.cnblogs.com/Kalenda/)

P3384: [Usaco2004 Nov]Apple Catching 接苹果的更多相关文章

  1. BZOJ 3384: [Usaco2004 Nov]Apple Catching 接苹果( dp )

    dp dp( x , k ) = max( dp( x - 1 , k - 1 ) + *** , dp( x - 1 , k ) + *** ) *** = 0 or 1 ,根据情况 (BZOJ 1 ...

  2. 3384/1750: [Usaco2004 Nov]Apple Catching 接苹果

    3384/1750: [Usaco2004 Nov]Apple Catching 接苹果 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 18  Solv ...

  3. bzoj 3384: [Usaco2004 Nov]Apple Catching 接苹果

    双倍经验题... -->1750 dp!! 3384: [Usaco2004 Nov]Apple Catching 接苹果 Time Limit: 1 Sec  Memory Limit: 12 ...

  4. bzoj3384[Usaco2004 Nov]Apple Catching 接苹果*&&bzoj1750[Usaco2005 qua]Apple Catching*

    bzoj3384[Usaco2004 Nov]Apple Catching 接苹果 bzoj1750[Usaco2005 qua]Apple Catching 题意: 两棵树,每分钟会从其中一棵树上掉 ...

  5. Apple Catching(POJ 2385)

    Apple Catching Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 9978   Accepted: 4839 De ...

  6. Apple Catching(dp)

    Apple Catching Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 9831   Accepted: 4779 De ...

  7. POJ2385——Apple Catching

                                                $Apple~Catching$ Time Limit: 1000MS   Memory Limit: 6553 ...

  8. 【POJ】2385 Apple Catching(dp)

    Apple Catching Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 13447   Accepted: 6549 D ...

  9. 【POJ - 2385】Apple Catching(动态规划)

    Apple Catching 直接翻译了 Descriptions 有两棵APP树,编号为1,2.每一秒,这两棵APP树中的其中一棵会掉一个APP.每一秒,你可以选择在当前APP树下接APP,或者迅速 ...

随机推荐

  1. chrome浏览器设置小于12号的字体不起作用?

    在某些chrome浏览器下,css里设置的10号字体竟然不起作用!仍显示12号大小,对比firefox.ie6.7.8.9,他们的显示都是好的. 要是你也碰到这问题,可以这样解决: -webkit-t ...

  2. 数学对象Math ceil()、floor()、round()方法

      Math.ceil()   功能:对一个数进行上取整. 语法:Math.ceil(x) 参数: x:一个数值. 返回值:返回大于或等于x,并且与之最接近的整数. 注:如果x是正数,则把小数“入”: ...

  3. plsql 登录后,提示数据库字符集(AL32UTF8)和客户端字符集(ZHS16GBK)不一致

    plsql 登录后,提示数据库字符集(AL32UTF8)和客户端字符集(ZHS16GBK)不一致 (2014-07-25 18:40:34)转载▼ 标签: it 分类: Database Databa ...

  4. poj2031 Building a Space Station

    这题目,用G++ WA,用C++ AC. 题目要求,现给出n个球,然后要使每两个球直接或者间接连通,可以在任意两球之间做管道(在表面),最后的要求是,如果使得都连通的话,管道最小长度是多少. 思路简单 ...

  5. Android IOS WebRTC 音视频开发总结(五七)-- 网络传输上的一种QoS方案

    本文主要介绍一种QoS的解决方案,文章来自博客园RTC.Blacker,欢迎关注微信公众号blacker,更多详见www.rtc.help QoS出现的背景: 而当网络发生拥塞的时候,所有的数据流都有 ...

  6. 【转】Linux Writeback机制分析

    1. bdi是什么? bdi,即是backing device info的缩写,顾名思义它描述备用存储设备相关描述信息,这在内核代码里用一个结构体backing_dev_info来表示. bdi,备用 ...

  7. ie8以下不兼容document.getElementsByName解决方法

    在IE8以认为只有文本标签才有name属性的,一些元素标签用document.getElementsByName获取不到DOM,如DIV,span等,这里做一下兼容. HTML: <div na ...

  8. 解决Linux中遇到No such device

    虚拟机备份转移后,网络启动异常,提示“SIOCSIFADDR: No such device” he problem lies in the fact that ethernet MAC addres ...

  9. 获取php的配置

    ini_get — 获取一个配置选项的值 返回值 成功是返回配置选项值的字符串,null 的值则返回空字符串.如果配置选项不存在,将会返回 FALSE. <?php /* 我们的 php.ini ...

  10. App Store最新审核指南(2015年3月更新版)

    苹果近日更新了App Store审核指南的相关章节,对此前版本进行了修改和完善.除了增加应用截图.预览等限制外,使用Apple Pay进行定期付款的应用程序必须展示每个阶段所需款额,费用归属以及如何取 ...