从列表/池中挑选东西的最佳算法?
我有一个水果清单 ['Apple', 'Banana', 'Orange', 'Grape']
人 A 想要拿苹果和香蕉
人 B 想要拿苹果和香蕉和橙子
人 C想拿橙子和葡萄
如果你想要的水果被拿走了,你就根本不能摘取任何水果。例如,可能的解决方案是:
A 和 C 拿走所有水果(最优)
B 拿走了苹果、香蕉、橙子
目标是拿走最多数量的水果(解决方案 1),是否有一种算法可以在不尝试所有组合的情况下计算出这一点?
I have a list of fruits ['Apple', 'Banana', 'Orange', 'Grape']
Person A wants to take Apple and Banana
Person B wants to take Apple and Banana and Orange
Person C wants to take Orange and Grape
If a fruit you want is taken, you cannot pick take any fruits at all. For example, the possible solutions for this are:
Person A and Person C takes all the fruits (most optimal)
Person B takes Apple, Banana, Orange
The goal is to take the most number of fruits (solution 1), is there an algorithm for figuring that out without trying all the combinations?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论