USACO Section 3.1: Score Inflation
完全背包问题
/* ID: yingzho1 LANG: C++ TASK: inflate */ #include <iostream> #include <fstream> #include <string> #include <map> #include <vector> #include <set> #include <algorithm> #include <stdio.h> #include <queue> #include <cstring> #include <cmath> #include <list> using namespace std; ifstream fin("inflate.in"); ofstream fout("inflate.out"); ; struct cat { int point; int time; cat(int a, int b) : point(a), time(b) { } cat() : point(), time() { } }; int total_time; int N; int main() { fin >> total_time >> N; vector<cat> pro(N); ; i < N; i++) { fin >> pro[i].point >> pro[i].time; } vector<); ; i < N; i++) { ; j*pro[i].time < total_time; j++) { ; j*pro[i].time+k <= total_time && k <= pro[i].time; k++) { /*if (f[j*pro[i].time+k] < f[(j-1)*pro[i].time+k]+pro[i].point) { f[j*pro[i].time+k] = f[(j-1)*pro[i].time+k]+pro[i].point; cout << "f[" << j*pro[i].time+k << "]: " << f[j*pro[i].time+k] << endl; }*/ f[j*pro[i].time+k] = max(f[j*pro[i].time+k], f[(j-)*pro[i].time+k]+pro[i].point); //cout << "f[" << j*pro[i].time+k << "]: " << f[j*pro[i].time+k] << endl; } } } fout << f[total_time] << endl; ; }
USACO Section 3.1: Score Inflation的更多相关文章
- 【USACO 3.1】Score Inflation(完全背包)
完全背包. http://train.usaco.org/usacoprob2?a=3Srffjlf4QI&S=inflate /* TASK:inflate LANG:C++ URL: */ ...
- USACO Score Inflation
洛谷 P2722 总分 Score Inflation https://www.luogu.org/problem/P2722 JDOJ 1697: Score Inflation https://n ...
- 洛谷P2722 总分 Score Inflation
P2722 总分 Score Inflation 184通过 295提交 题目提供者该用户不存在 标签USACO 难度普及- 提交 讨论 题解 最新讨论 关于算法 题目背景 学生在我们USACO的 ...
- 洛谷——P2722 总分 Score Inflation(背包)
P2722 总分 Score Inflation 题目背景 学生在我们USACO的竞赛中的得分越多我们越高兴. 我们试着设计我们的竞赛以便人们能尽可能的多得分,这需要你的帮助 题目描述 我们可以从几个 ...
- P2722 总分 Score Inflation (完全背包模板)
题目传送门:P2722 总分 Score Inflation 题目描述 我们可以从几个种类中选取竞赛的题目,这里的一个"种类"是指一个竞赛题目的集合,解决集合中的题目需要相同多的时 ...
- USACO Section 1.3 题解 (洛谷OJ P1209 P1444 P3650 P2693)
usaco ch1.4 sort(d , d + c, [](int a, int b) -> bool { return a > b; }); 生成与过滤 generator&& ...
- 洛谷——2722总分 Score Inflation
题目背景 学生在我们USACO的竞赛中的得分越多我们越高兴. 我们试着设计我们的竞赛以便人们能尽可能的多得分,这需要你的帮助 题目描述 我们可以从几个种类中选取竞赛的题目,这里的一个"种类& ...
- AC日记——总分 Score Inflation 洛谷 P2722
题目背景 学生在我们USACO的竞赛中的得分越多我们越高兴. 我们试着设计我们的竞赛以便人们能尽可能的多得分,这需要你的帮助 题目描述 我们可以从几个种类中选取竞赛的题目,这里的一个"种类& ...
- 洛谷——P2722 总分 Score Inflation
https://www.luogu.org/problem/show?pid=2722 题目背景 学生在我们USACO的竞赛中的得分越多我们越高兴. 我们试着设计我们的竞赛以便人们能尽可能的多得分,这 ...
随机推荐
- Linux网络编程实例解析
**************************************************************************************************** ...
- Hdu 1009 FatMouse' Trade 分类: Translation Mode 2014-08-04 14:07 74人阅读 评论(0) 收藏
FatMouse' Trade Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) ...
- 引擎设计跟踪(九.14.2b) 骨骼动画基本完成
首先贴一个介绍max的sdk和骨骼动画的文章, 虽然很早的文章, 但是很有用, 感谢前辈们的贡献: 3Ds MAX骨骼动画导出插件编写 1.Dual Quaternion 关于Dual Quatern ...
- Linux软件安装方法小结(附:rpm详解)(转载)
在使用Linux系统的过程中,软件包的安装是避免不了的,在Linux下,软件安装程序的种类很多,安装方法也各式各样,(舒适性自然比不上windows :-))不过我们常见的软件包有两种: 1)含有软件 ...
- 定位position详解:relative与absolute
定位标签:position 包含属性:relative(相对) absolute(绝对) 1.position:relative; 如果对一个元素进行相对定位,首先它将出现在它所在的位置上.然后通过设 ...
- 十大技巧优化Android App性能
无论锤子还是茄子手机的不断冒出,Android系统的手机市场占有率目前来说还是最大的,因此基于Android开发的App数量也是很庞大的. 那么,如何能开发出更高性能的Android App?相信是软 ...
- ****RESTful API 设计最佳实践(APP后端API设计参考典范)
http://blog.jobbole.com/41233/ 背景 目前互联网上充斥着大量的关于RESTful API(为方便,下文中“RESTful API ”简写为“API”)如何设计的文章,然而 ...
- 饶有兴致的用javascript做了个贪食蛇游戏
09年写的东西.一直藏在自己的记事本里头,现在开始整理写博客,所以直接搬过来 先上效果图 再添代码: <HTML> <HEAD> <TITLE>贪吃蛇 Snake ...
- Struts2 Convention插件的使用(4)使用@Action注解返回json数据
package com.hyy.action; import java.util.HashMap; import java.util.Map; import org.apache.struts2.co ...
- Linux静态库和动态库
Linux 工具 ❑ GCC: The GNU Compiler Collection, containing the GNU C compiler❑ G++: A C++ compiler, inc ...