bzoj 3384: [Usaco2004 Nov]Apple Catching 接苹果
双倍经验题。。。 -->1750
dp!!
3384: [Usaco2004 Nov]Apple Catching 接苹果
Time Limit: 1 Sec Memory Limit: 128 MB
Submit: 61 Solved: 52
[Submit][Status][Discuss]
Description
Input
Output
Sample Input
2
1
1
2
2
1
1
Sample Output
HINT
7分钟内共掉落7个苹果一一第1个从第2棵树上掉落,接下来的2个苹果从第1棵树上掉落,再接下来的2个从第2棵树上掉落,最后2个从第1棵树上掉落. 贝茜不移动直到接到从第1棵树上掉落的两个苹果,然后移动到第2棵树下,直到接到从第2棵
树上掉落的两个苹果,最后移动到第1棵树下,接住最后两个从第1棵树上掉落的苹果.这样贝茜共接住6个苹果.
Source
Gold
#include<cstdio>
int max(int a,int b){return a>b?a:b;}
int t,w,dp[][][],n[],ans;
int main()
{
scanf("%d%d",&t,&w);
for(int i=;i<=t;i++) scanf("%d",&n[i]);
for(int i=;i<=t;i++)
{
dp[i][][]=dp[i-][][]+(n[i]==);
dp[i][][]=dp[i-][][]+(n[i]==);
for(int j=;j<=w;j++)
{
dp[i][j][]=max(dp[i-][j-][],dp[i-][j][])+(n[i]==);
dp[i][j][]=max(dp[i-][j-][],dp[i-][j][])+(n[i]==);
ans=max(ans,max(dp[i][j][],dp[i][j][]));
}
}
printf("%d",ans);
}
bzoj 3384: [Usaco2004 Nov]Apple Catching 接苹果的更多相关文章
- 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 ...
- 3384/1750: [Usaco2004 Nov]Apple Catching 接苹果
3384/1750: [Usaco2004 Nov]Apple Catching 接苹果 Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 18 Solv ...
- bzoj3384[Usaco2004 Nov]Apple Catching 接苹果*&&bzoj1750[Usaco2005 qua]Apple Catching*
bzoj3384[Usaco2004 Nov]Apple Catching 接苹果 bzoj1750[Usaco2005 qua]Apple Catching 题意: 两棵树,每分钟会从其中一棵树上掉 ...
- P3384: [Usaco2004 Nov]Apple Catching 接苹果
一道DP题, f[i,j,k] 表示 第 k 时刻 由 1 位置 变换 j 次 到达 当前 i 棵树 注意也要维护 变换 0 次的情况. var i,j,k,t,w,now:longint; tree ...
- BZOJ 3385: [Usaco2004 Nov]Lake Counting 数池塘
题目 3385: [Usaco2004 Nov]Lake Counting 数池塘 Time Limit: 1 Sec Memory Limit: 128 MB Description 农夫 ...
- Apple Catching(POJ 2385)
Apple Catching Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 9978 Accepted: 4839 De ...
- Apple Catching(dp)
Apple Catching Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 9831 Accepted: 4779 De ...
- POJ2385——Apple Catching
$Apple~Catching$ Time Limit: 1000MS Memory Limit: 6553 ...
- 【POJ】2385 Apple Catching(dp)
Apple Catching Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 13447 Accepted: 6549 D ...
随机推荐
- 常见网络命令之traceroute命令一起其他常用命令
备注:任何命令+/?就可以显示命令帮助,比如:ipconfig /?. traceroute命令 traceroute是UNIX系统中的名字,用来跟踪一个分组从源点到终点的路径.在Windows系统中 ...
- YUV颜色编码解析(转)
原文转自 https://www.jianshu.com/p/a91502c00fb0
- 【Python学习笔记】Pandas库之DataFrame
1 简介 DataFrame是Python中Pandas库中的一种数据结构,它类似excel,是一种二维表. 或许说它可能有点像matlab的矩阵,但是matlab的矩阵只能放数值型值(当然matla ...
- 网络设备之pci_driver
每个pci驱动都有一个pci_driver实例,用以描述驱动名称,支持的设备信息,以及对应的操作函数: /* 描述一个pci设备,每个pci驱动必须创建一个pci_driver实例 */ struct ...
- python 判断文件的创建时间和当前时间的比较
import os import time import datetime filePath=r"C:\pyweibo\cookies5673210223" ctime=os.pa ...
- The content of element type "resultMap" must match "(constructor?,id*,result*,association*,collectio
The content of element type "resultMap" must match "(constructor?,id*,result*,associa ...
- vue 同页面不同参数
项目:详情页中有一个模块为更多产品,点击也是跳转到详情页,也就是相同路由,不同参数. 试过的方法:用this.$router.push,并没有任何反应,没有任何请求,页面也未重新加载,用this.$e ...
- 支持flv的播放神器
h1:让浏览器支持flv去https://github.com/Bilibili/flv.js h2:让手机电脑都支持mp4使用: <link rel="stylesheet" ...
- Nginx+PHP “No input file specified”错误的解决办法
配置官网商城php网站时候,界面报错“No input file specified” 原理: 任何对.php文件的请求,都简单地交给php-cgi去处理,但没有验证该php文件是否存在. PHP文件 ...
- cocos2d-js中怎么删除一个精灵
添加元素时,有Name属性 var child = parent.addChild(label, 1, "元素的名字"); 或者给child设置tag child.setTag(& ...