HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Contests > CEN254 Resit > problem:


1. 50840 - Tanker trucks

CEN254 Resit

Start: July.13.2017 at 09:50:00 AM
Finish: July.13.2017 at 10:45:00 AM
The contest is finished!
• Contest scoreboard

Guest
• Review clarifications (1)

Contest problems

• 1. 50840 - Tanker trucks

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.
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