当前位置:网站首页>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
边栏推荐
- Taxable income
- DJ music management software pioneer DJ rekordbox
- 还原二叉树 (25 分)
- Illegal character in scheme name at index 0:
- L2-023 图着色问题 (25 分)(图的遍历)
- Find the sum of simple types of matrices
- First principle mind map
- Latex paper typesetting operation
- Multi view depth estimation by fusing single view depth probability with multi view geometry
- MySQL small exercise (only suitable for beginners, non beginners are not allowed to enter)
猜你喜欢
随机推荐
企业微信应用授权/静默登录
bashdb下载安装
基于点云凸包的凹包获取方法
Wechat: get the owner of a single tag
L2-3 浪漫侧影 (25 分)
Chris LATTNER, father of llvm: the golden age of compilers
First principle mind map
论文阅读《Multi-View Depth Estimation by Fusing Single-View Depth Probability with Multi-View Geometry》
Write down the post order traversal of the ~ binary tree
Common errors of VMware building es8
Experimental report on analysis of overflow vulnerability of assembly language and reverse engineering stack
npm报错 :operation not permitted, mkdir ‘C: \Program Files \node js \node_ cache _ cacache’
Star Trek's strong attack opens the dream linkage between metacosmic virtual reality
小程序报错:Cannot read property 'currentTarget' of undefined
Production practice elk
Initial experience of talent plan learning camp: communication + adhering to the only way to learn open source collaborative courses
Talent Plan 学习营初体验:交流+坚持 开源协作课程学习的不二路径
计算神经网络推理时间的正确方法
Notes on xctf questions
[in-depth good article] detailed explanation of Flink SQL streaming batch integration technology (I)