主页
题目
状态
排名
OI排名
统计
题解
请登录
常用链接
AOJ考试平台
老赵的Gitee代码
编译原理模拟考试平台
Java技术手册
FCC网站
菜鸟网
在线工具箱
字节豆包GPT
代码可视化
力扣网
牛客网
洛谷
杭电OJ
CodeForce
隐藏编译器
Problem I: 3.1.2 Score Inflation
上一题
正确率: $52.94\%$
下一题
Time Limit
$1$ 秒/Second(s)
Memory Limit
$512$ 兆字节/Megabyte(s)
提交总数
$34$
正确数量
$18$
"
裁判形式
标准裁判/Standard Judge
我的状态
尚未尝试
难度
分类标签
usaco
动态规划
背包
×
为本题添加算法分类(请不要超过5个)
当前分类(单击移除):
usaco
动态规划
背包
单击选择分类:
Description
<p style="font-family:-webkit-standard;"> The more points students score in our contests, the happier we here at the USACO are. We try to design our contests so that people can score as many points as possible, and would like your assistance. </p> <p style="font-family:-webkit-standard;"> We have several categories from which problems can be chosen, where a "category" is an unlimited set of contest problems which all require the same amount of time to solve and deserve the same number of points for a correct solution. Your task is write a program which tells the USACO staff how many problems from each category to include in a contest so as to maximize the total number of points in the chosen problems while keeping the total solution time within the length of the contest. </p> <p style="font-family:-webkit-standard;"> The input includes the length of the contest, M (1 <= M <= 10,000) (don't worry, you won't have to compete in the longer contests until training camp) and N, the number of problem categories, where 1 <= N <= 10,000. </p> <p style="font-family:-webkit-standard;"> Each of the subsequent N lines contains two integers describing a category: the first integer tells the number of points a problem from that category is worth (1 <= points <= 10000); the second tells the number of minutes a problem from that category takes to solve (1 <= minutes <= 10000). </p> <p style="font-family:-webkit-standard;"> Your program should determine the number of problems we should take from each category to make the highest-scoring contest solvable within the length of the contest. Remember, the number from any category can be any nonnegative integer (0, one, or many). Calculate the maximum number of possible points. </p> <div> <br /> </div>
Input
<table border="1" style="font-family:-webkit-standard;"> <tbody> <tr> <td> Line 1:<span class="Apple-converted-space"> </span> </td> <td> M, N -- contest minutes and number of problem classes<span class="Apple-converted-space"> </span> </td> </tr> <tr> <td> Lines 2-N+1:<span class="Apple-converted-space"> </span> </td> <td> Two integers: the points and minutes for each class<br /> </td> </tr> </tbody> </table>
Output
<span style="font-family:-webkit-standard;font-size:medium;">A single line with the maximum number of points possible given the constraints.</span> <div> <span style="font-family:-webkit-standard;font-size:medium;"><br /> </span> </div>
Sample Input
300 4 100 60 250 120 120 100 35 20
Sample Output
605
登录后提交代码
题面与样例可直接查看,登录后即可在线提交和评测。
前往登录