
背包
文章平均质量分 73
CCloth
这个作者很懒,什么都没留下…
展开
-
[dp优化]Chip Move Codeforces1716D
有n个点顺序排列在1~n,起点在0,第i次跳跃的距离需要是m+i-1的倍数,且跳跃距离不能为0,问跳到每个点的方案数。原创 2022-09-14 20:19:09 · 289 阅读 · 0 评论 -
[01背包][排序]Proud Merchants HDU3466
Recently, iSea went to an ancient country. For such a long time, it was the most wealthy and powerful kingdom in the world. As a result, the people in this country are still very proud even if their nation hasn’t been so wealthy any more.The merchants wer原创 2022-05-01 16:50:55 · 230 阅读 · 0 评论 -
多重背包的各种优化
一、朴素做法最朴素的解法就是枚举这种物品具体要选多少个,时间复杂度为O(n*v*m),n为物品种类,v为背包体积,m为物品个数。以4. 多重背包问题 I为例,贴一个代码:#include <bits/stdc++.h>using namespace std;int w[105], v[105], num[105], dp[105];signed main(){ int n, m; cin >> n >> m; for(int原创 2022-03-30 09:49:56 · 796 阅读 · 0 评论 -
[好题][01背包变形]Steadily Growing Steam 第46届icpc区域赛上海站I
题目描述Alice enjoys playing a card game called Steadily Growing Steam (as known as SGS).In this game, each player will play different roles and have different skills. Players get cards from the deck and use them to play the game. Each card has a numeric la原创 2022-03-03 20:50:37 · 533 阅读 · 0 评论 -
[裴蜀定理][完全背包]最大体积 c语言网1643
题目描述每个物品有一定的体积(废话),不同的物品组合,装入背包会占用一定的总体积。假如每个物品有无限件可用,那么有些体积是永远也装不出来的。为了尽量装满背包,附中的OIER想要研究一下物品不能装出的最大体积。题目保证有解,如果是有限解,保证不超过2,000,000,000如果是无限解,则输出0输入第一行一个整数n(n< =10),表示物品的件数第2行到N+1行: 每件物品的体积(1< = < =500)输出一个整数ans,表示不能用这些物品得到的最大体积。...原创 2022-02-25 21:19:25 · 413 阅读 · 0 评论