Ask which number of numbers are close to a given value (less than or equal to)

Source: Internet
Author: User
In life, there is often a situation in which:

Online shopping, a fixed shopping voucher 1000, there are many goods, the unit price is different, 101,230,330,210,299, ...
How to use the 1000 yuan as much as possible.

This is just an example of a specific conversion into a computer professional description I don't know how to express it,
Question: What number of numbers to approximate a given value (less or equal)

Such a business logic, how to use the algorithm it? Unlimited language. (C,php,java,node)

Reply content:

In life, there is often a situation in which:

Online shopping, a fixed shopping voucher 1000, there are many goods, the unit price is different, 101,230,330,210,299, ...
How to use the 1000 yuan as much as possible.

This is just an example of a specific conversion into a computer professional description I don't know how to express it,
Question: What number of numbers to approximate a given value (less or equal)

Such a business logic, how to use the algorithm it? Unlimited language. (C,php,java,node)

This problem falls into the 背包问题 category and can be solved by it 贪心算法 .

01 knapsack problem

This is typical 01背包问题 , the most common is to 动态规划 solve

  • 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.