Help a friend collect algorithm code. Let's start your head and use your wisdom to participate.

Source: Internet
Author: User

A friend just askedAlgorithmThe problem is as follows:

There are a pile of wood rods with a length between 1 m and 21 m (the length is an integer). The user-defined wood rod length is also the number of custom wood rods.
One group of sample data is 300 of 10 m wooden sticks, 223 of 14 m wooden sticks, 412 of 18 m wooden sticks, and 301 of 2 m wooden sticks, 5-meter wooden stick with 48
What I want is, how many 21-meter-long wooden sticks can these wooden sticks make up? (Wood sticks cannot be cut, but can be spliced ).

 

This is a typical algorithm problem. It is similar to the data structure of the C language version in the current year and the one in the algorithm: How many rooster, hen, and chicken are bought in RMB (their prices are different ), how many solutions are available.

 

The simplest solution to this type of problem is the exhaustive method. You can try to write its C #, Java, C, and PHP algorithms, or use other algorithms to solve the problem, we look forward to your participation. Thank you.

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.