BZOJ——1606: [Usaco2008 Dec]Hay For Sale 购买干草
http://www.lydsy.com/JudgeOnline/problem.php?id=1606
Time Limit: 5 Sec Memory Limit: 64 MB
Submit: 1420 Solved: 1052
[Submit][Status][Discuss]
Description
Input
Output
Sample Input
2
6
5
The wagon holds 7 volumetric units; three bales are offered for sale with
volumes of 2, 6, and 5 units, respectively.
Sample Output
HINT
Buying the two smaller bales fills the wagon.
Source
#include <cstdio> #define max(a,b) (a>b?a:b) inline void read(int &x)
{
x=; register char ch=getchar();
for(; ch>''||ch<''; ) ch=getchar();
for(; ch>=''&&ch<=''; ch=getchar()) x=x*+ch-'';
}
int C,H,v[],f[]; int Presist()
{
read(C),read(H);
for(int i=; i<=H; ++i) read(v[i]);
for(int i=; i<=H; ++i)
for(int j=C; j>=v[i]; j--)
f[j]=max(f[j],f[j-v[i]]+v[i]);
printf("%d\n",f[C]);
return ;
} int Aptal=Presist();
int main(int argc,char**argv){;}
BZOJ——1606: [Usaco2008 Dec]Hay For Sale 购买干草的更多相关文章
- BZOJ 1606: [Usaco2008 Dec]Hay For Sale 购买干草( dp )
-------------------------------------------------------------------- #include<cstdio> #include ...
- 01背包 || BZOJ 1606: [Usaco2008 Dec]Hay For Sale 购买干草 || Luogu P2925 [USACO08DEC]干草出售Hay For Sale
题面:P2925 [USACO08DEC]干草出售Hay For Sale 题解:无 代码: #include<cstdio> #include<cstring> #inclu ...
- bzoj 1606: [Usaco2008 Dec]Hay For Sale 购买干草
Description 约翰遭受了重大的损失:蟑螂吃掉了他所有的干草,留下一群饥饿的牛.他乘着容量为C(1≤C≤50000)个单位的马车,去顿因家买一些干草. 顿因有H(1≤H≤5000)包 ...
- BZOJ 1606: [Usaco2008 Dec]Hay For Sale 购买干草(动态规划)
裸的背包= =,没什么好说的= = CODE: #include<cstdio>#include<iostream>#include<algorithm>#incl ...
- bzoj 1606: [Usaco2008 Dec]Hay For Sale 购买干草【01背包】
在洛谷上被卡常了一个点! 就是裸的01背包咯 为啥我在刷水题啊 #include<iostream> #include<cstdio> #include<algorith ...
- 1606: [Usaco2008 Dec]Hay For Sale 购买干草
Description 约翰遭受了重大的损失:蟑螂吃掉了他所有的干草,留下一群饥饿的牛.他乘着容量为C(1≤C≤50000)个单位的马车,去顿因家买一些干草. 顿因有H(1≤H≤5000)包 ...
- BZOJ1606: [Usaco2008 Dec]Hay For Sale 购买干草
1606: [Usaco2008 Dec]Hay For Sale 购买干草 Time Limit: 5 Sec Memory Limit: 64 MBSubmit: 612 Solved: 46 ...
- bzo1606: [Usaco2008 Dec]Hay For Sale 购买干草
1606: [Usaco2008 Dec]Hay For Sale 购买干草 Time Limit: 5 Sec Memory Limit: 64 MBSubmit: 1338 Solved: 9 ...
- bzoj1606[Usaco2008 Dec]Hay For Sale 购买干草(01背包)
1606: [Usaco2008 Dec]Hay For Sale 购买干草 Time Limit: 5 Sec Memory Limit: 64 MBSubmit: 1240 Solved: 9 ...
随机推荐
- GloVe:另一种Word Embedding方法
若想深层地理解GloVe和本文,最好了解SVD, word2vec(skip-gram为主)的相关知识.若仅寻求一种新的word embedding方法,可以不必了解以上前置知识. 一言以蔽之,Glo ...
- AOP日志组件 多次获取post参数
AOP日志组件 多次获取post参数 需求:新增接口日志组件.通过拦截器对接口URL进行拦截处理,然后将接口post请求的参数与结果,写入日志表. 问题:POST方法的参数是存储在request.ge ...
- input标签内容改变触发的事件
原生方法 onchange事件 <input type="text" onchange="onc(this)"> function onc(data ...
- pycharm添加wordcloud模块时报错:error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools
windows 7 32bit python3.6.3 32bit pycharm2018社区版 32bit 问题说明: 添加wordcloud模块时报错:error: Microsoft Visua ...
- 杭电 5773 The All-purpose Zero
Description ?? gets an sequence S with n intergers(0 < n <= 100000,0<= S[i] <= 1000000). ...
- Tomcat下部署PHP
php线程安全版和非线程安全版本区别 1.windows + IIS + FastCGI :使用非线程安全版本. 解释: 以FastCGI方式安装PHP时,PHP拥有独立的进程,并且FastCGI是单 ...
- linux 环境下bash脚本中找不到命令
mr.sh: line 1: HADOOP_CMD: command not found mr.sh: line 4: INPUT_FILE_PATH: command not found mr.sh ...
- 五、docker配置镜像加速器之阿里云
1 配置docker加速器 实在忍受不了pull的速度--------- 访问网址: https://dev.aliyun.com/search.html 点击管理中心: 根据操作稳定配置:
- numpy.clip(a, a_min, a_max, out=None)(values < a_min are replaced with a_min, and those > a_max with a_max.)
numpy.clip(a, a_min, a_max, out=None) Clip (limit) the values in an array. Given an interval, values ...
- HLG 2025
确定大小 Time Limit: 1000 MS Memory Limit: 32768 K Total Submit: 50(15 users) Total Accepted: 12(11 user ...