一道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. 571亿背后:DRC助阿里实现异地双活

    571亿背后:DRC助阿里实现异地双活 赶集网SQL自动上线

  2. 五、用户数据报传输(UDP)

    1.UDP常用的发送和接收函数 int recvfrom(int sockfd,void *buf,int len,unsigned int flags,struct sockaddr *from,i ...

  3. Javascript之严格模式详解

    一.概述 除了正常运行模式,ECMAscript 5添加了第二种运行模式:"严格模式"(strict mode).顾名思义,这种模式使得Javascript在更严格的条件下运行. ...

  4. Android IOS WebRTC 音视频开发总结(五一)-- 降噪基本原理

    文章主要介绍噪声消除,文章来自博客园RTC.Blacker,支持原创,转载必须说明出处,欢迎关注微信公众号blacker,更多详见www.rtc.help ---------------------- ...

  5. objective-C常量与变量

    1.Objective-C中声明常量使用关键字const.如:const double PI = 3.1514; 2.Objective-C中变量可以分为成员变量.局部变量和全局变量(用的很少,尽量不 ...

  6. Web Service 中返回DataSet结果的几种方法

    Web Service 中返回DataSet结果的几种方法: 1)直接返回DataSet对象    特点:通常组件化的处理机制,不加任何修饰及处理:    优点:代码精减.易于处理,小数据量处理较快: ...

  7. SQL服务器更改名称后

    SQL服务器更改名称后 编写人:CC阿爸 2014-6-15 在日常SQL 2005数据库的操作中,有时安装完成数据库后,再更名,造成部分SQL服务不能正常使用(在SQL2000 时,想都别想更名了) ...

  8. 四、MongoDB的查询

    一.MongoDB的下载.安装与部署 二.MongoDB的基础知识简介 三.MongoDB的创建.更新和删除 db.blogs.insert([ { "author": " ...

  9. nginx学习笔记1

    Nginx是使用c语言编写的,查看nginx编译时参数的设定  使用nginx -V命令查看 可以使用nginx -h命令查看命令帮助 配置文件中将worker process绑定到cpu的特定内核上 ...

  10. PHP生成二维码库phpqrcode

    Description PHP QR Code is open source (LGPL) library for generating QR Code, 2-dimensional barcode. ...