HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Contests > IMPC - 2013-2014 > problem:


2013-05-50. 50593 - Transporter

IMPC - 2013-2014

Start: Mar.16.2013 at 12:00:00 PM
Finish: Mar.16.2013 at 05:00:00 PM
The contest is finished!
• Contest scoreboard

Guest
• Review clarifications (2)

Contest problems

• 2013-04-40. 50338 - Convert Into ...
• 2013-04-50. 50774 - Hot Potato
• 2013-04-70. 50296 - Total Discount...
• 2013-04-80. 50343 - The number of...
• 2013-04-90. 50332 - Variance of a ...
• 2013-05-10. 50552 - Casual shoes
• 2013-05-30. 50580 - Days passed
• 2013-05-40. 50553 - Divisible by m
• 2013-05-50. 50593 - Transporter
• 2013-12-10. 50352 - Selling Cows
• 2013-12-40. 50342 - 100 Factorial
• 2013-12-50. 50674 - Collecting Eggs
• 2013-Nov-01. 50328 - How far away
• 2013-Nov-02. 50347 - Selling Oranges
• 2013-Nov-05. 50354 - Intersecting ...

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
Prepared by Ibrahim Mesecan.

Transporter

Shqip

Mr. Ardit has a shipping company. He transports the packages of other people from Tirana to Shkoder. Because he is shipping packages of other people, he is not able to break apart the packages, and he has to ship them as they have been given. His car can ship at most C kilograms, thus he cannot always move all the packages at once. He has to choose some packages that best fits to his car capacity.

Question:
Write a program that is going to get the weights of n packages and choose the packages in such a way that the total weights of selected packages is the highest and less than or equal to the given capacity C.

Input specification
First, you will be given two integers: the number of packages (n) and the amount (C) that his car can carry where 1 ≤ n ≤ 12 and 1 < C ≤ 1000. Then, you will be given n integers which represent the weights of the given packages. And, each of the package have at most 100Kgs.

Output specification
As the output, give a single integer which shows the highest amount that he can carry with his car.

Sample Input I
  5 16
  4 5 4 4 6
Sample Output I
  15
 Sample Input II
  6 13
  3 3 3 3 3 4
 Sample Output II
  13

Output Explanation :
  Input 1: He can carry at most 15Kgs, when the packages 4, 5, and 6 are selected.
  Input 2: If the packages 3, 3, 3, and 4 are selected, he can carry 13Kgs.


Для отправки решений необходимо выполнить вход.

www.contester.ru