您当前的位置: 首页 > 

*DDL_GzmBlog

暂无认证

  • 3浏览

    0关注

    605博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

Acwing 423采药 &&01背包的优化

*DDL_GzmBlog 发布时间:2021-04-02 18:29:22 ,浏览量:3

传送门

在这里插入图片描述 题目一看赤裸裸的01背包, 那么就直接上板子吧顺便还去理解了一下怎么做优化 (嘻嘻)

#include 
using namespace std;
int t,m;
const int N  = 1100;
int f[N][N];
int a[N],b[N];
int main()
{
    cin>>t>>m;
    for(int i=1;i>a[i]>>b[i];

    for(int i=1;i> n;

    for (int i = 0; i > v >> w;
        for (int j = m; j >= v; j -- )
            f[j] = max(f[j], f[j - v] + w);
    }

    cout             
关注
打赏
1657615554
查看更多评论
0.0433s