博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
SDNU 1539 Do you like Hot Dog ?
阅读量:7070 次
发布时间:2019-06-28

本文共 1292 字,大约阅读时间需要 4 分钟。

Description

Hot dog is a very delicious food,and Goc like it very much. The picture below shows how much does Goc like it. hhhhh...
Given a set of hot dog, each with a price and a happy value , determine a way to choose the items into a knapsack so that the total price is less than or equal to a given limit ​ and the total happy value is as large as possible. Find the maximum total happy value. (Note that each item can be only chosen once).

Input

The first line contains the integer ​ indicating to the number of test cases.

For each test case, the first line contains the integers ​ and ​.

Following ​ lines provide the information of each item.

The line contains the price and the happy value of the ​ item respectively.

 

 

 

All the inputs are integers.

Output

For each test case, output the maximum value.

Sample Input

15 1512 42 21 14 101 2

Sample Output

15
#include 
#include
#include
#include
#include
#include
using namespace std;#define ll long longint t, n, pri, p[500+8], v[500+8], dp[500+8][5000+8], sum;void solve(){ fill(dp[0], dp[0] + 5005, 0x3f3f3f3f); dp[0][0] = 0; for(int i = 0; i

 

转载于:https://www.cnblogs.com/RootVount/p/10326113.html

你可能感兴趣的文章
Jquery mobiscroll 移动设备(手机)wap日期时间选择插件以及滑动、滚动插件
查看>>
Tuxera NTFS for Mac 拼团仅需¥99!再见原价¥298!
查看>>
如何恢复u盘误删文件,看完就不会觉得自己很菜了
查看>>
WPF中ListBox滚动时的缓动效果
查看>>
javaOOM该分析dump文件而不是看异常log日志原因
查看>>
vue组件值传递之父组件向子组件传递(props)
查看>>
MySQL5.6 主从复制 ERROR 1776 (HY000): Parameters MASTER_LOG_FILE
查看>>
mysql重启,重启释放ibtmp1
查看>>
我是一个线程(修订版) 转
查看>>
numpy二分查找
查看>>
DevExpress第三方控件使用实例之ASPxPopupControl弹出子窗体
查看>>
【视频】ASP.NET Core MVC 2.* 入门
查看>>
Go基础系列:接口类型断言和type-switch
查看>>
Presentational and Container Components
查看>>
windows系统-phpstudy升级mysql8.0.12安装教程及修改密码和安装注意事项
查看>>
Android 性能优化的方面方面都在这儿
查看>>
clover无缘无故隐藏书签栏原因
查看>>
Spark 用户自定义函数 Java 示例
查看>>
RabbitMQ 发布订阅
查看>>
Python&R&量化 金融之路
查看>>