一道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. 通用简单的 分页 SQL

    select                ID,TITLE,CONTENT,USERNAME,REALNAME,UNIT,UNITID,NOWTIMES,ACCEPTERID,ACCEPTERNAM ...

  2. poj1019_Number_Sequence

    这题目关键是打表,haha[k]数组表示的是S1S2..Sk该串结尾所在的位置.然后用n去找n所在的k值,此时haha[k-1]<n<=haha[k].然后再算出从haha[k]位置到n一 ...

  3. 使用C#三维绘图控件快速搭建DXF查看程序

    本例使用AnyCAD .Net三维图形控件快速实现一个DXF文件的读取.显示.导出JPG.PNG.PDF的应用. 代码: using System; using System.Collections. ...

  4. 基本的Web控件二

    ListBox控件 ListBox控件用于创建多选的列表框,而可选项是通过ListItem元素来定义的. ListBox控件常用的属性: 1.Count:表示列表框中条目的总数. 2.Items:表示 ...

  5. 介绍一点.NET反编译的知识

    反编译是我们理解.NET内部实现的一种良好的手段. 程序编译时 Test.exe是IL代码.我们可以通过一些工具,来查看这些IL代码. 一模一样? 理论上来说,一模一样的反编译是不存在的.原因有以下3 ...

  6. Hive[4] 数据定义 HiveQL

    HiveQL 是 Hive 查询语言,它不完全遵守任一种 ANSI SQL 标准的修订版,但它与 MySQL 最接近,但还有显著的差异,Hive 不支持行级插入,更新和删除的操作,也不支持事务,但 H ...

  7. css3- border

    css3-border 1.border-color 2.border-image 3.border-radius (  none | <length>{1,4} [ / <leng ...

  8. POJ C++程序设计 编程题#3 编程作业—运算符重载

    编程题 #3 来源: POJ (Coursera声明:在POJ上完成的习题将不会计入Coursera的最后成绩.) 注意: 总时间限制: 1000ms 内存限制: 65536kB 描述 写一个二维数组 ...

  9. c#中winform的MVP模式的简单实现

    MVP模式是类似于MVC模式的一种设计模式,最近在做项目学习过程中遇到,弄了很久终于有一些眉目,这是学习过程中的一些笔记.MVP指的是实体对象Model.视图Viw和业务处理Presenter.MVP ...

  10. [leetcode]_Add Two Numbers

    题目:两个链表存储数字,然后求和,和值存储在一个链表中. 代码: public ListNode addTwoNumbers(ListNode l1, ListNode l2) { ListNode ...