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

Разделы > Переборные задачи > задача:


50840 - Tanker trucks

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

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

• 50717 - Hurdle Jumping
• Check-Mate
• 50710 - Permutations
• 50709 - k-ary Strings
• 50708 - Binary Strings
• 50996 - Checkers - the shortest path
• 51067 - Jumping frog
• Post Office Delivery
• 50840 - Tanker trucks
• 51142 - Jump Min Value
• 50490 - Across the River
• 50828 - Arranging Time Table
• 51082 - Sum is equal to K - 1
• 50506 - The Biggest Island
• 50718 - Elevator
• 50472 - Minimum Sum Triangle
• 50593 - Transportimi

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

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

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

Tanker trucks

Mr. Jones has a small dairy production factory. Everyday he goes through the neighboring farms and collects milk with his two tanker trucks. He wants to collect the maximum amount not exceeding his tanker capacities. And if he can not buy all milk from a farm, he doesn't want to go to that farm so that he is not going to spend extra gasoline.

Question: Write a program that is going to get the capacities of two tanker trucks and the amount of milk that neighbors can supply. Then, print the max amount of milk that can be collected.

Input specification
In the first line, you will be given three integers: The number of neighboring farms (n) and the capacities of two tankers (Cap1, Cap2). Then in the following line, you will be given n integers where 3 ≤ n ≤ 16, 0 ≤ (Cap1, Cap2) ≤ 1,000. and the amount of milk that neighboring farms can supply are integers between 0 and 100.

Output specification:
Show the max amount of milk that can be collected.
Note:

  1. Each input number can be used only once.
  2. From any farm, you can either buy all the milk or no milk at all.

Sample Input I
6 80 100
30 50 20 30 30 30
Sample Input II
6 90 100
30 20 30 30 30 50
Sample Output I
170
Sample Output II
190

Explanation for sample input 1:
The two tankers can hold 80 + 90 = 170 liters. The first tanker take (30 + 50) liters from two farms.
And the other tanker can collect from the other three farms (30 + 30 + 30).



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

www.contester.ru