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的竞赛中的得分越多我们越高兴. 我们试着设计我们的竞赛以便人们能尽可能的多得分,这 ...
随机推荐
- java 多个设备,锁定先后顺序
场景图: 4台android设备需要被锁定顺序,下次的时候按顺序socket推送数据到这4台不同的内容.当有新的一台机器加入时,如上图的E,则插入到原位置为C的地方.具体代码如下: public st ...
- 【Search Insert Position 】cpp
题目: Given a sorted array and a target value, return the index if the target is found. If not, return ...
- Log4j2 配置笔记(Eclipse+maven+SpringMVC)
Log4j2相关介绍可以百度看下,这里只注重配置Log4j2 能够马上跑起来: 1.pom.xml文件中添加Log4j2的相关Maven配置信息 <!-- log4j2 --> <d ...
- 二分---LIGHTOJ 1062
1062 - Crossed Ladders PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit: 32 MB A ...
- C# TcpListener的编程要点
using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Ne ...
- MongoDB 基础
1. 安装 mongodb-win32-x86_64-2008plus-2.6.12-signed.msi,下载地址 https://www.mongodb.com/download-center#c ...
- js获得浏览器页面高宽
不同的浏览器可能会有一些差别,使用的时候请先进行测试. var s = ""; s += " 网页可见区域宽:"+ document.body.clientWi ...
- E3: PS4/PC 莎木3 众筹200万美元 9小时内达成
这次E3任天堂没有新掌机(传说中的XDS呢.呵呵)和口袋的消息, 被喷得很严重, 索尼的FF7重制版和莎木3是亮点. 而莎木3的众筹速度据说创了记录, 玩家的情怀大胜. 笔者看到国内也有赞助几十刀的玩 ...
- ios瀑布流
http://blog.csdn.net/shenjx1225/article/details/9037631
- 使用PHP_UML生成代码的UML图
在读别人代码的时候, 在没有详细文档的时候, 如何快速的看清整个代码的结构(类结构), 就成为了一个现实的问题. 今天我就介绍一种, 自动生成UML图的方法. 假设, 我有一个项目文件夹:laruen ...