The sum of the numbers is close to a given value (less than or equal)

Source: Internet
Author: User
In life, there is often a situation: online shopping, a fixed shopping coupon of 1000, there are a lot of goods, the unit price is different, 101,230,330,210,299,... how can we use this 1000 yuan as much as possible. This is just an example. I don't know how to convert it into a computer professional. in my life, there is often a situation like this:

Online shopping, a fixed shopping coupon of 1000, there are many products, the unit price is different, 101,230,330,210,299 ,...
How can we use this 1000 yuan as much as possible.

This is just an example. I don't know how to express it as a computer professional,
Example:The sum of the numbers is close to a given value (less than or equal)

What algorithm should be used for such a business logic? Unlimited language. (C, php, java, node)

Reply content:

In life, there is often such a situation:

Online shopping, a fixed shopping coupon of 1000, there are many products, the unit price is different, 101,230,330,210,299 ,...
How can we use this 1000 yuan as much as possible.

This is just an example. I don't know how to express it as a computer professional,
Example:The sum of the numbers is close to a given value (less than or equal)

What algorithm should be used for such a business logic? Unlimited language. (C, php, java, node)

This problem belongsBackpack problemsCategory, applicableGreedy algorithm.

01 backpack problems

This is typical01 backpack problems, The most common is to useDynamic planningSolution

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.