当前位置:网站首页>Group Backpack
Group Backpack
2022-07-29 08:41:00 【蒟】
#include<bits/stdc++.h>
using namespace std;
const int N = 110;
int dp[N];
int v[N][N], w[N][N], s[N];
int main() {
int n, m;
cin >> n >> m;
for (int i = 1; i <= n; i++) {
cin >> s[i];
for (int j = 1; j <= s[i]; j++) {
cin >> v[i][j] >> w[i][j];
}
}
for(int i=1;i<=n;i++)
{
for(int j=m;j>=0;j--)
{
for(int k=1;k<=s[i];k++)
{
if(j>=v[i][k])
{
dp[j]=max(dp[j],dp[j-v[i][k]]+w[i][k]);
}
}
}
}
cout<<dp[m];
return 0;
}
/*
The dynamic transfer equation is dp[i][j]=max(dp[i-1][j-v[i][k]]+w[i][k];
*/
边栏推荐
- 7.1-default-arguments
- Chrony time synchronization
- GBase 8s数据库有哪些备份恢复方式
- Day4: the establishment of MySQL database and its simplicity and practicality
- Fastjson's tojsonstring() source code analysis for special processing of time classes - "deepnova developer community"
- 2022年P气瓶充装考试模拟100题模拟考试平台操作
- HC-SR04超声波测距模块使用方法和例程(STM32)
- Eggjs create application knowledge points
- RPC和REST
- Day15: the file contains the vulnerability range manual (self use file include range)
猜你喜欢

HC-SR04超声波测距模块使用方法和例程(STM32)

(视频+图文)机器学习入门系列-第3章 逻辑回归

数学建模——微分方程

Clion+opencv+aruco+cmake configuration

2022 electrician (elementary) test question simulation test platform operation

Simple operation of SQL server data table

ROS tutorial (Xavier)

Google browser cross domain configuration free

Data warehouse layered design and data synchronization,, 220728,,,,

Analysis of zorder sampling partition process in Hudi - "deepnova developer community"
随机推荐
How to quickly experience oneos
Chrony time synchronization
6.3 references
Solve the problem of MSVC2017 compiler with yellow exclamation mark in kits component of QT
7.1-default-arguments
Day15: the file contains the vulnerability range manual (self use file include range)
Curl -v | JQ
Source code compilation pytorch pit
Day15 (day16 extension): file contains vulnerability
01背包关于从二维优化到一维
SAP sm30 brings out description or custom logical relationship
7.2-function-overloading
7.3-function-templates
WQS binary learning notes
2022.7.9 quick view of papers
Collation of ml.net related resources
Demonstration and solution of dirty reading, unrepeatable reading and unreal reading
BI data analysis practitioners learn financial knowledge from scratch? What introductory books are recommended
access数据库可以被远程访问吗
Day4: the establishment of MySQL database and its simplicity and practicality