当前位置:网站首页>二维01背包
二维01背包
2022-04-23 07:21:00 【2020100XWH】
直接二维倒序枚举
#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://blog.csdn.net/xuwnehao/article/details/124350707
边栏推荐
- 5.6 综合案例-RTU-
- The whole house intelligence bet by the giant is driving the "self revolution" of Hisense, Huawei and Xiaomi
- 单点登录 SSO
- ASAN 极简原理
- Fibula dynamic programming
- Search the complete navigation program source code
- 谈谈那些基础但不简单的股票数据
- QFileDialog 选择多个文件或文件夹
- Rearranging log files for leetcode simple question
- 通过实现参数解析器HandlerMethodArgumentResolver接口来自定义注解
猜你喜欢

Green apple film and television system source code film and television aggregation film and television navigation film and television on demand website source code

There are some problems when using numeric type to query string type fields in MySQL

Positioning of high precision welding manipulator

Campus transfer second-hand market source code download
![[appium] encountered the problem of switching the H5 page embedded in the mobile phone during the test](/img/4a/c741ec4f9aa724e150a5ae24d0f9e9.png)
[appium] encountered the problem of switching the H5 page embedded in the mobile phone during the test

【Appium】测试时遇到手机内嵌H5页面的切换问题

freertos学习02-队列 stream buffer message buffer

dried food! Point based: differentiable Poisson solver

The third divisor of leetcode simple question

Idea: export Yapi interface using easyyapi plug-in
随机推荐
Positioning of high precision welding manipulator
Manipulator motion planning in 3C assembly
数据的删除和修改操作(mysql)
怎么读书读论文
关于ORB——SLAM运行中关键帧位置越来越近的异常说明
C outputs a two-dimensional array with the following characteristics.
在MATLAB中快速画圆(给出圆心坐标和半径就能直接画的那种)
刨析——浏览器如何工作
浅谈ES6尾调优化
LeetCode简单题之计算字符串的数字和
[Effective Go 中文翻译]函数篇
Convert object to URL
JS converts tree structure data into one-dimensional array data
C language learning record -- use and analysis of string function (2)
【解释】get ORA-12838: cannot read/modify an object after modifying it in parallel
搜一下导航完整程序源码
JS common array methods
colorui 解决底部导航遮挡内容问题
多目视觉SLAM
js将树形结构数据转为一维数组数据