当前位置:网站首页>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];
*/
边栏推荐
- 正则表达式校验版本号
- 【Transformer】ATS: Adaptive Token Sampling For Efficient Vision Transformers
- QT learning: use non TS files such as json/xml to realize multilingual internationalization
- Importerror: no module named XX
- Application of matrix transpose
- Day15 (day16 extension): file contains vulnerability
- Opencv cvcircle function
- 【OpenCV】-算子(Sobel、Canny、Laplacian)学习
- Sword finger offer 50. the first character that appears only once
- Deep learning (2): image and character recognition
猜你喜欢

SAP ooalv-sd module actual development case (add, delete, modify and check)

Play Parkour with threejs Technology

Day13: file upload vulnerability

Application of matrix transpose

Hc-sr04 use method and routine of ultrasonic ranging module (STM32)

Normal visualization

2022.7.9 quick view of papers

【OpenCV】-算子(Sobel、Canny、Laplacian)学习

Common query optimization technology of data Lake - "deepnova developer community"

LeetCode力扣题目总结(题目编号:53、3、141、面试题022、剑指offer链表中环的入口节点、20、19、牛客NC1、103、1143、牛客127)
随机推荐
6.2 function-parameters
Basic shell operations (Part 2)
SAP sm30 brings out description or custom logical relationship
GBase 8s数据库有哪些备份恢复方式
Thrift installation manual
Use disco diffusion to generate AI artwork in moment pool cloud
Ar virtual augmentation and reality
Clickhouse learning (I) Clickhouse?
QT version of Snake game project
Ga-rpn: recommended area network for guiding anchors
英语高频后缀
Day5: PHP simple syntax and usage
Transaction management in SQL Server
【OpenCV】-算子(Sobel、Canny、Laplacian)学习
Day15 (day16 extension): file contains vulnerability
2022 question bank and answers of operation certificate examination for main principals of hazardous chemical business units
Search and recall classic questions (eight queens)
Sword finger offer 50. the first character that appears only once
Markdown concise grammar manual
用户身份标识与账号体系实践