当前位置:网站首页>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];
*/
边栏推荐
- Google browser cross domain configuration free
- Collation of ml.net related resources
- 2022年R2移动式压力容器充装考题模拟考试平台操作
- Ga-rpn: recommended area network for guiding anchors
- Reading of false news detection papers (3): semi supervised content-based detection of misinformation via tensor embeddings
- 2022电工(初级)考题模拟考试平台操作
- PostgreSQL manually creates hikaridatasource to solve the error cannot commit when autocommit is enabled
- 用户身份标识与账号体系实践
- [opencv] - Operator (Sobel, canny, Laplacian) learning
- Osgsimplegl3 combined with renderdoc tool
猜你喜欢

谷歌浏览器免跨域配置

(视频+图文)机器学习入门系列-第2章 线性回归

Basic shell operations (Part 1)

Simple operation of SQL server data table

C language function output I love you

Selenium actual combat case crawling JS encrypted data

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

Error reporting when adding fields to sap se11 transparent table: structural changes at the field level (conversion table xxxxx)

Clickhouse learning (III) table engine

Clickhouse learning (II) Clickhouse stand-alone installation
随机推荐
Second week of postgraduate freshman training: convolutional neural network foundation
Sword finger offer 32 - ii Print binary tree II from top to bottom
Squareline partners with visual GUI development of oneos graphical components
预训练模型与传统方法在排序上有啥不同?
A little knowledge [synchronized]
完全背包问题 从朴素到终极
SAP ooalv-sd module actual development case (add, delete, modify and check)
Day13: file upload vulnerability
(视频+图文)机器学习入门系列-第3章 逻辑回归
Crawling JS encrypted data of playwright actual combat case
Data warehouse layered design and data synchronization,, 220728,,,,
GBase 8s数据库有哪些备份恢复方式
Day5: PHP simple syntax and usage
多重背包,朴素及其二进制优化
2022年山东省安全员C证上岗证题库及答案
Chrony 时间同步
AI application lesson 1: C language Alipay face brushing login
Osgsimplegl3 combined with renderdoc tool
Error reporting when adding fields to sap se11 transparent table: structural changes at the field level (conversion table xxxxx)
Basic shell operations (Part 1)