gpt4 book ai didi

c - 算法:最大化糕点店的产量。没有贪心算法怎么办?

转载 作者:塔克拉玛干 更新时间:2023-11-03 04:12:57 25 4
gpt4 key购买 nike

<分区>

这里的问题:

you got a list of ingredients (assuming their value unitary) withtheir respective quantities, and a list of products. Each product gota price and the recipe which contain the needed ingredients an theirquantities.

You need is to maximize the total proceeds from those products withthe given ingredients.

我脑海中浮现的第一件事是创建价格/(n° 需要的项目)比率并开始创建具有最高比率的产品。我知道这是某种贪心算法(如果我没记错的话),并不总能得出最佳解决方案,但我没有其他可实现的想法。

另一种方法可能是暴力破解所有的可能性,但我无法实现它;我对暴力破解不太熟悉。我的第一个暴力算法是 this one , 但它很容易,因为它带有数字,而且后面的元素不会被前面的元素排除。

这里的情况有所不同,因为下一个元素是可用成分的函数,这些成分受先前产品的影响,依此类推。

你有什么提示吗?这是某种作业,所以我不喜欢直接的解决方案,而是可以从中着手!


我必须使用的语言是C

提前致谢:)

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com