在费用和重量阈值中对项目代码进行排序 [英] sort item code with in the cost and weight threshold

查看:74
本文介绍了在费用和重量阈值中对项目代码进行排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有10个具有成本价格和重量的商品.我的起征点价格为1000,起重重量为100kg.我想在这些起征点中获取最大数量的物品.
即itemcost<阈值cost ="和=" sum =" of =" the =" weight =" less =" than =" threshold =">

i have 10 items with cost price and weight.my threshold cost is 1000 and threshold weight is 100kg.i want to take maximum number of items with in these threshold.
i.e. sum of the itemcost<threshold cost="" and="" sum="" of="" the="" weight="" less="" than="" threshold="">

推荐答案

这听起来像是作业,但是由于您将其发布为一般性问题,因此我将对您的具体电话号码给出一般性回答(也就是说,我不确定我会否建议将其用于任意数量的商品.)

十个项目中的每一个都可以包含或不包含,因此您正在查看2 ^ 10种可能的组合.从收集所有十种物品开始,看看是否满足成本和重量限制.如果不是,请查看十套九件商品,看看其中是否满足成本和重量限制.继续到八个,七个,六个...项目,直到满足条件为止.
This sounds like homework, but since you post this as a general question I''ll give a general answer to your specific numbers (that is, I''m not sure I would recommend this for an arbitrary number of items).

Each of the ten items can either be included or not so you''re looking at 2^10 possible combinations. Start with the collection of all ten items and see if that satisfies the cost and weight limitations. If not, look at the ten sets of nine items and see whether any of those satisfy the cost and weight limitations. Continue to eight, seven, six... items until you satisfy the conditions.


这篇关于在费用和重量阈值中对项目代码进行排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆