ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Разделы > Динамическое программирование > задача:


50686 - The Container

Гость
• Вопросы к жюри (1)

Задачи раздела

• 51010 - Max Sequential Sum
• 51072 - Castle on chessboard
• 51075 - Shortest Path for Bishop
• 50688 - Epoka Furgon
• 50524 - Elevator
• 50536 - Epoka Furgon Shpk
• 50687 - Pascal Triangle - 2
• 50689 - The biggest building block
• 50686 - The Container
• 50682 - Hotel Durres
• 50930 - Tom and Jerry
• 50526 - Gold Market
• 50488 - Connecting Wires
• 50681 - Center of a Series
• 50561 - Lucky tickets
• 50598 - Shuma minimale
• 50601 - Возрастающая последоват...

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Question by Ibrahim Mesecan.

The Container

A Cargo shipping company, uses large container ships and bulk carriers to carry cargos from different people. The cargos cannot be separated into pieces and the ship can carry at most certain amount of tones.

Question:
Given a set of items determine the max weight that can be carried such that it is less than or equal to a given capacity.

Input specification
Firstly, you are given two integer numbers (n and C) where n denotes the number of items and C denotes the total amount of tones (capacity) that the ship can carry. The next line will have n integer numbers where 1 ≤ n ≤ 100 and 1 ≤ C ≤ 1000. Each cargo item can be between 1 and 20 tones.

Output specification
Show just one integer number: max weight that can be carried with the ship.

Sample Input I   
5 15
3 4 5 6 8
Sample Input II   
8 15
2 2 2 2 2 2 2 2
Sample Output I   
15
Sample Output II   
14


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

www.contester.ru