当前位置:网站首页>2D 01 Backpack
2D 01 Backpack
2022-04-23 09:03:00 【2020100XWH】
Direct two-dimensional reverse enumeration
#include<bits/stdc++.h>
using namespace std;
int dp[205][205];
int main()
{
int n,m,t;
cin>>n>>m>>t;
int mm[105],tt[105];
for(int i=1;i<=n;++i)
{
cin>>mm[i]>>tt[i];
}
for(int i=1;i<=n;++i)
{
for(int j=m;j>=mm[i];--j)
{
for(int k=t;k>=tt[i];--k)
{
dp[j][k]=max(dp[j][k],dp[j-mm[i]][k-tt[i]]+1);
}
}
}
cout<<dp[m][t];
return 0;
}
版权声明
本文为[2020100XWH]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230721150251.html
边栏推荐
- Failed to prepare device for development
- 基于点云凸包的凹包获取方法
- Restore binary tree (25 points)
- Arbre de dépendance de l'emballage des ressources
- Correct method of calculating inference time of neural network
- npm报错 :operation not permitted, mkdir ‘C: \Program Files \node js \node_ cache _ cacache’
- 是否完全二叉搜索树 (30 分)
- Mini - exercice MySQL (seulement pour les débutants, pas pour les non - débutants)
- [indexof] [lastIndexOf] [split] [substring] usage details
- dataBinding中使用include
猜你喜欢

OneFlow學習筆記:從Functor到OpExprInterpreter

Mini - exercice MySQL (seulement pour les débutants, pas pour les non - débutants)

Arbre de dépendance de l'emballage des ressources

To remember the composition ~ the pre order traversal of binary tree

调包求得每个样本的k个邻居

Harbor enterprise image management system

论文阅读《Multi-View Depth Estimation by Fusing Single-View Depth Probability with Multi-View Geometry》

深度学习框架中的自动微分及高阶导数

Study notes of deep learning (8)

First principle mind map
随机推荐
Illegal character in scheme name at index 0:
Is Zhongyan futures safe and reliable?
Go language self-study series | initialization of golang structure
Flink同时读取mysql与pgsql程序会卡住且没有日志
爬虫使用xpath解析时返回为空,获取不到相应的元素的原因和解决办法
Bk3633 specification
Latex paper typesetting operation
Taxable income
MySQL查询两张表属性值非重复的数据
Restore binary tree (25 points)
The K neighbors of each sample are obtained by packet switching
To remember the composition ~ the pre order traversal of binary tree
[indexof] [lastIndexOf] [split] [substring] usage details
深度学习框架中的自动微分及高阶导数
Correct method of calculating inference time of neural network
The crawler returns null when parsing with XPath. The reason why the crawler cannot get the corresponding element and the solution
[original] use system Text. JSON formats the JSON string
K210 learning notes (II) serial communication between k210 and stm32
使用flask和h5搭建网站/应用的简要步骤
调包求得每个样本的k个邻居