当前位置:网站首页>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
边栏推荐
- 资源打包关系依赖树
- The K neighbors of each sample are obtained by packet switching
- Restore binary tree (25 points)
- Multi view depth estimation by fusing single view depth probability with multi view geometry
- 应纳税所得额
- 单片机数码管秒表
- Latex paper typesetting operation
- tsdf +mvs
- Download and install bashdb
- Complete binary search tree (30 points)
猜你喜欢
ONEFLOW learning notes: from functor to opexprinter
Experimental report on analysis of overflow vulnerability of assembly language and reverse engineering stack
npm ERR! network
Open services in the bottom bar of idea
L2-022 rearrange linked list (25 points) (map + structure simulation)
深度学习框架中的自动微分及高阶导数
Summary of solid problems
Data visualization: use Excel to make radar chart
PLC point table (register address and point table definition) cracking detection scheme -- convenient for industrial Internet data acquisition
Download and install bashdb
随机推荐
求简单类型的矩阵和
Consensus Token:web3.0生态流量的超级入口
L2-3 romantic silhouette (25 points)
2022-04-22 openebs cloud native storage
LeetCode396. Rotate array
基于ThinkPHP5版本TRC20-资金归集解决方案
OneFlow学习笔记:从Functor到OpExprInterpreter
OneFlow學習筆記:從Functor到OpExprInterpreter
valgrind和kcachegrind使用運行分析
Non duplicate data values of two MySQL query tables
1099 establish binary search tree (30 points)
DJ music management software pioneer DJ rekordbox
資源打包關系依賴樹
Flink同时读取mysql与pgsql程序会卡住且没有日志
The crawler returns null when parsing with XPath. The reason why the crawler cannot get the corresponding element and the solution
Download and install bashdb
LeetCode_DFS_中等_1254. 统计封闭岛屿的数目
Mini - exercice MySQL (seulement pour les débutants, pas pour les non - débutants)
L2-023 graph coloring problem (25 points) (graph traversal)
The K neighbors of each sample are obtained by packet switching