Dumb Bear Moving Pack

Source: Internet
Author: User

Dumb Bear Move Package Description:
The stupid bear in the forest is happy today-he bought a new house and moved to move a new home. Therefore, the stupid bear invited a lot of good friends to help move, and prepared a lot of small cartons to carry the goods, but the volume of these cartons are the same, and up to two items can be loaded. However, in order not to disturb too many friends, stupid bear thought of a "smart" approach: make each carton use the most efficient (note: As long as the carton volume is larger than the volume of the sum of the goods is considered to be installed; In order to help the stupid bear to inform friends in advance, please according to the method of the dumb bear, help to calculate: How much is the minimum number of cartons?
Run time limit: Unlimited memory limit: Unlimited input:
Integer v--the volume of the carton, integer n--the total number of items n;
A total of n integers (corresponding to the volume of n items, each integer separated by a space).
Output:
Integer m--minimum number of trays required

Sample Input: Ten 2 2 3 Sample output: 1

Dumb Bear Moving Pack

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.