【BZOJ3407】[Usaco2009 Oct]Bessie's Weight Problem 贝茜的体重问题【01背包】
【题目链接】
...
/* Pigonometry */
#include <cstdio>
#include <algorithm>using namespace std;const int maxn = 505, maxm = 45005;int n, m, w[maxn], dp[maxm];inline int iread() {int f = 1, x = 0; char ch = getchar();for(; ch < '0' || ch > '9'; ch = getchar()) f = ch == '-' ? -1 : 1;for(; ch >= '0' && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';return f * x;
}int main() {m = iread(); n = iread();for(int i = 1; i <= n; i++) w[i] = iread();for(int i = 1; i <= n; i++) for(int j = m; j >= w[i]; j--)dp[j] = max(dp[j], dp[j - w[i]] + w[i]);printf("%d\n", dp[m]);return 0;
}
【BZOJ3407】[Usaco2009 Oct]Bessie's Weight Problem 贝茜的体重问题【01背包】相关推荐
- bzoj 3407: [Usaco2009 Oct]Bessie's Weight Problem 贝茜的体重问题(DP)
3407: [Usaco2009 Oct]Bessie's Weight Problem 贝茜的体重问题 Time Limit: 3 Sec Memory Limit: 128 MB Submit: ...
- [BZOJ1643][Usaco2007 Oct]Bessie's Secret Pasture 贝茜的秘密草坪
1643: [Usaco2007 Oct]Bessie's Secret Pasture 贝茜的秘密草坪 Time Limit: 5 Sec Memory Limit: 64 MB Submit: ...
- bzoj 1643: [Usaco2007 Oct]Bessie's Secret Pasture 贝茜的秘密草坪(DP)
1643: [Usaco2007 Oct]Bessie's Secret Pasture 贝茜的秘密草坪 Time Limit: 5 Sec Memory Limit: 64 MB Submit: ...
- 3409: [Usaco2009 Oct]Barn Echoes 牛棚回声
3409: [Usaco2009 Oct]Barn Echoes 牛棚回声 Time Limit: 3 Sec Memory Limit: 128 MB Submit: 57 Solved: 47 ...
- bzoj 3386 bzoj 3408: [Usaco2009 Oct]Heat Wave 热浪(最短路)
3408: [Usaco2009 Oct]Heat Wave 热浪 Time Limit: 3 Sec Memory Limit: 128 MB Submit: 301 Solved: 223 [ ...
- bzoj 3406: [Usaco2009 Oct]Invasion of the Milkweed 乳草的入侵
3406: [Usaco2009 Oct]Invasion of the Milkweed 乳草的入侵 Time Limit: 3 Sec Memory Limit: 128 MB Submit: ...
- 1875 贝茜的报复(dfs、二进制)
1. 问题描述: 农夫约翰和奶牛贝茜喜欢在业余时间互相出数学题.约翰给贝茜出了一道相当难的问题,导致她没能解决.现在,她希望通过给约翰出一道有挑战性的难题来报复他.贝茜给了约翰一个表达式 (B+E+S ...
- 【 FZU - 2214 】Knapsack problem(逆向0-1背包)
题干: Given a set of n items, each with a weight w[i] and a value v[i], determine a way to choose the ...
- BZOJ 1613: [Usaco2007 Jan]Running贝茜的晨练计划
题目 1613: [Usaco2007 Jan]Running贝茜的晨练计划 Time Limit: 5 Sec Memory Limit: 64 MB Description 奶牛们打算通过锻炼来 ...
最新文章
- hdu4560 不错的建图,二分最大流
- 从Q3财报看百度营销成长
- 利用ffmpeg转换mp4文件
- 初学ctypes:打开进程并返回相关信息
- 基坑监测日报模板_刚刚!温州瓯海突发塌陷,初步判断为临近地块地下室基坑支护桩移位...
- log4j.appender.stdout.layout.ConversionPattern
- 采用光线跟踪绘制场景 c++_光线追踪必定是未来趋势,CJ现场带给你全新体验
- [Angular 2] Using events and refs
- 网络协议端口号说明(转)
- AndroidQ(10.0) MTK 开机 Logo 动态替换
- Linux C 语言内联汇编
- protel99实用基础入门教程
- 音量控制面板项目说明
- 几种典型的反病毒技术:特征码技术、覆盖法技术等
- QQ在线客服设置-QQ开启临时会话教程
- 库里扛起了勇士对凯尔特人的第四场
- Frog青蛙的约会【浙江省选2002】(数论)
- unity实现点线智能连接+1
- 信息系统项目管理师 第三章-项目立项管理
- 3.2 写一个UR机器人运动学库
热门文章
- Verilog设计流程:综合(一)
- SVN: an error occurred and the operation could not be completed
- ORA-00392: log 4 of thread 2 is being cleared, operation not allowed
- Oracle:ORA-00392: log 3 of thread 1 is being cleared, operation not allowed
- 红尘梦醒雪无踪,花落无息香如故
- nib must contain exactly one top level object which must be a UITableViewCell instance
- Linux查看各种解压文件
- git 拉取所有远程分支
- oppor17刷鸿蒙系统,三个原因告诉你 为何OPPO R17能够如此受追捧
- 决策树(Decision Tree)理解及参数介绍