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的竞赛中的得分越多我们越高兴. 我们试着设计我们的竞赛以便人们能尽可能的多得分,这 ...
随机推荐
- 【Binary Tree Inorder Traversal】cpp
题目: Given a binary tree, return the inorder traversal of its nodes' values. For example:Given binary ...
- 【BZOJ】【1717】【USACO 2006 Dec】Milk Patterns产奶的模式
后缀数组 o(︶︿︶)o 唉傻逼了一下,忘了把后缀数组的字典范围改回20001,直接21交了上去,白白RE了两发……sigh 既然要找出现了K次的子串嘛,那当然要用后缀数组了>_>(因为我 ...
- HDOJ 1429 胜利大逃亡(续)
胜利大逃亡(续) Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Su ...
- 100个经典的C算法
1.题目:古典问题:有一对兔子,从出生后第3个月起每个月都生一对兔子,小兔 子长到第三个月后每个月又生一对兔子,假如兔子都不死,问每个月的兔子总数 为多少? #include<stdio.h&g ...
- javascript实现数据结构:串--堆分配存储表示
堆分配存储表示 这种存储表示的特点是,仍以一组地址连续的存储单元存放串值字符序列,但它们的存储空间是在程序执行过程中动态分配而得. 结构图: 实现: function HString(){ this. ...
- 2014ACM-ICPC 西安赛区总结
万万没想到,打铁了.以前一直觉得拿铁咖啡的梗是很好笑的,然后有一天这杯咖啡自己喝下去了,就会发现心里真的被梗住了. 复旦的题其实我是有预料到的,前年的复旦题三题从金区到铜区都有,但是从去年的南京赛区开 ...
- iScroll.js 用法参考
本文原文链接:http://www.cnblogs.com/duanhuajian/archive/2013/04/08/3008323.html 概要 iScroll 4 这个版本完全重写了iScr ...
- Xcode 创建静态库和动态库
1.linux中静态库和动态库区别: 库从本质上来说是一种可执行代码的二进制格式,可以被载入内存中执行.库分静态库和动态库两种. 静态库:这类库的名字一般是libxxx.a:利用静态函数库编译成的文件 ...
- 2014 ACM/ICPC Asia Regional Xi'an Online(HDU 5007 ~ HDU 5017)
题目链接 A题:(字符串查找,水题) 题意 :输入字符串,如果字符串中包含“ Apple”, “iPhone”, “iPod”, “iPad” 就输出 “MAI MAI MAI!”,如果出现 “Son ...
- 今天来做一个PHP电影小爬虫。
今天来做一个PHP电影小爬虫.我们来利用simple_html_dom的采集数据实例,这是一个PHP的库,上手很容易.simple_html_dom 可以很好的帮助我们利用php解析html文档.通过 ...