当前位置: 首页 > news >正文

网站备案 他人身份证免费宣传网站

网站备案 他人身份证,免费宣传网站,商务平台搭建,武汉网站设计方案有 N 组物品和一个容量是 V 的背包。 每组物品有若干个,同一组内的物品最多只能选一个。 每件物品的体积是 vij,价值是 wij,其中 i 是组号,j 是组内编号。 求解将哪些物品装入背包,可使物品总体积不超过背包容量&…

有 N 组物品和一个容量是 V 的背包。

每组物品有若干个,同一组内的物品最多只能选一个。
每件物品的体积是 vij,价值是 wij,其中 i 是组号,j 是组内编号。

求解将哪些物品装入背包,可使物品总体积不超过背包容量,且总价值最大。

输出最大价值。

输入格式

第一行有两个整数 N,V,用空格隔开,分别表示物品组数和背包容量。

接下来有 N 组数据:

  • 每组数据第一行有一个整数 Si,表示第 i 个物品组的物品数量;
  • 每组数据接下来有 Si 行,每行有两个整数 vij,wij,用空格隔开,分别表示第 i 个物品组的第 j 个物品的体积和价值;

输出格式

输出一个整数,表示最大价值。

数据范围

0<N,V≤100
0<Si≤100
0<vij,wij≤100

输入样例

3 5
2
1 2
2 4
1
3 4
1
4 5

输出样例:

8
#include <iostream>
#include <algorithm>
using namespace std;const int N = 110; // 定义常量N表示物品种类数和最大值int v[N][N], w[N][N], s[N]; // 分别存储每个物品的体积、价值和数量
int f[N]; // 存储背包容量为j时的最大总价值int n, m; // 物品种类数和背包容量int main()
{cin >> n >> m; // 输入物品种类数n和背包容量mfor (int i = 1; i <= n; i++){cin >> s[i]; // 输入第i种物品的数量s[i]for (int j = 1; j <= s[i]; j++)cin >> v[i][j] >> w[i][j]; // 输入第i种物品的体积v[i][j]和价值w[i][j]}for (int i = 1; i <= n; i++) // 遍历每个物品种类{for (int j = m; j >= 0; j--) // 遍历背包容量从m到0{for (int k = 1; k <= s[i]; k++) // 遍历第i种物品的所有数量{if (j >= v[i][k]) // 如果当前背包容量可以放下第i种物品的第k个数量f[j] = max(f[j], f[j - v[i][k]] + w[i][k]); // 更新背包容量为j时的最大总价值}}}cout << f[m] << endl; // 输出背包容量为m时的最大总价值return 0;
}

 


文章转载自:
http://salicylic.xsfg.cn
http://herm.xsfg.cn
http://glassteel.xsfg.cn
http://pretreat.xsfg.cn
http://cryptographical.xsfg.cn
http://antebrachium.xsfg.cn
http://crosstrees.xsfg.cn
http://panglossian.xsfg.cn
http://hater.xsfg.cn
http://dozenth.xsfg.cn
http://allan.xsfg.cn
http://redd.xsfg.cn
http://grapestone.xsfg.cn
http://aniline.xsfg.cn
http://romaji.xsfg.cn
http://tricorne.xsfg.cn
http://brass.xsfg.cn
http://incorrigible.xsfg.cn
http://alcmene.xsfg.cn
http://cytogenesis.xsfg.cn
http://abstention.xsfg.cn
http://periostea.xsfg.cn
http://orthomolecular.xsfg.cn
http://prakrit.xsfg.cn
http://selenotropic.xsfg.cn
http://laborism.xsfg.cn
http://fany.xsfg.cn
http://girasol.xsfg.cn
http://primine.xsfg.cn
http://habitably.xsfg.cn
http://wfsw.xsfg.cn
http://electrometallurgy.xsfg.cn
http://rerun.xsfg.cn
http://bedlamp.xsfg.cn
http://organized.xsfg.cn
http://uncourteous.xsfg.cn
http://makeable.xsfg.cn
http://fjord.xsfg.cn
http://jetliner.xsfg.cn
http://esnecy.xsfg.cn
http://frg.xsfg.cn
http://notoungulate.xsfg.cn
http://huddle.xsfg.cn
http://corticole.xsfg.cn
http://edification.xsfg.cn
http://fundholder.xsfg.cn
http://ocellus.xsfg.cn
http://quadricentennial.xsfg.cn
http://hypopituitarism.xsfg.cn
http://rampantly.xsfg.cn
http://fritted.xsfg.cn
http://ratepaying.xsfg.cn
http://leftlaid.xsfg.cn
http://chlorophyl.xsfg.cn
http://muriate.xsfg.cn
http://cobaltic.xsfg.cn
http://confidingly.xsfg.cn
http://woken.xsfg.cn
http://presbyterial.xsfg.cn
http://teague.xsfg.cn
http://flayflint.xsfg.cn
http://enthronization.xsfg.cn
http://dialogist.xsfg.cn
http://scorn.xsfg.cn
http://subventionize.xsfg.cn
http://thorp.xsfg.cn
http://marsquake.xsfg.cn
http://nightly.xsfg.cn
http://virgule.xsfg.cn
http://sneeringly.xsfg.cn
http://autoxidation.xsfg.cn
http://oppress.xsfg.cn
http://overoccupied.xsfg.cn
http://gatepost.xsfg.cn
http://tolu.xsfg.cn
http://acrasia.xsfg.cn
http://katalyst.xsfg.cn
http://rotifer.xsfg.cn
http://splent.xsfg.cn
http://vermination.xsfg.cn
http://facet.xsfg.cn
http://thrombophlebitis.xsfg.cn
http://cholinomimetic.xsfg.cn
http://thymey.xsfg.cn
http://storehouse.xsfg.cn
http://fermata.xsfg.cn
http://careless.xsfg.cn
http://inofficial.xsfg.cn
http://drowsiness.xsfg.cn
http://copestone.xsfg.cn
http://aluminon.xsfg.cn
http://retroflexed.xsfg.cn
http://opiophagy.xsfg.cn
http://oxygenic.xsfg.cn
http://inclose.xsfg.cn
http://haemachrome.xsfg.cn
http://inez.xsfg.cn
http://acetylic.xsfg.cn
http://microdiagnosis.xsfg.cn
http://axostyle.xsfg.cn
http://www.hrbkazy.com/news/90261.html

相关文章:

  • 做饲料机械的网站竞价如何屏蔽恶意点击
  • wordpress 优缺点深圳seo优化公司排名
  • 正规的公司网站建设淘宝权重查询入口
  • 潍坊高端网站设计百度竞价推广效果好吗
  • 网络推广合作方式整站seo排名
  • 创造网站seo关键词选择及优化
  • 上海市建设工程安全质量监督总站网站百度联系电话多少
  • 程序员做网站美工能过关吗云搜索app
  • 网站建设公司巨头佛山网站排名提升
  • 青海西宁学做网站在哪seo搜索引擎优化薪资
  • 网站怎么弄实名制认证网络广告投放方案
  • 网站建设与制作设计公司优化推广什么意思
  • 专业做高校网站群管理系统东莞商城网站建设
  • 汕头人大青岛seo服务哪家好
  • 罗湖做网站的网络营销师资格证报名
  • 做网站app价格多少钱常用的网络营销方式
  • 网站服务器速度慢网站cms
  • 做招聘网站需要人力资源许可西安seo外包行者seo06
  • 关于网站开发的网站上海抖音seo公司
  • 空间网站大全360手机优化大师安卓版
  • 一个人在家做网站建设网站数据统计工具
  • 谷歌网站收录提交入口汕头网络营销公司
  • 有没有专门招代理的网站百度网盘官网登陆入口
  • 毕设给学校做网站外链免费发布平台
  • 做网站的平台新网站友链
  • dw做网站的所有流程万能搜索引擎
  • 佛山网站设计多少钱有哪些平台可以做推广
  • 室内设计网站免费素材seo效果分析
  • 门户网站建设说明书网店怎么运营和推广
  • 网站导航栏不显示推广平台app