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

Турниры > CEN112 Questions 2016 > задача:


15-MdtE-6. 50914 - Buy 3, Pay 2

CEN112 Questions 2016

Старт: 30.мар.2016 в 15:10:22
Финиш: 01.апр.2016 в 05:00:00
Турнир завершён!
• Турнирная таблица

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

Задачи турнира

• 15-HW-3. 50933 - Sum of the Bigges...
• 15-HW-4. 50934 - Selling Cars
• 15-HW-5. 50935 - Max Discount
• 15-MdtE-1. 50915 - Trip to Korca
• 15-MdtE-2. 50916 - Ascending Num...
• 15-MdtE-3. 50913 - Manhattan Distance
• 15-MdtE-4. 50917 - Descending Nu...
• 15-MdtE-5. 50912 - Trip to Librazhd
• 15-MdtE-6. 50914 - Buy 3, Pay 2
• 15-PE-1. 50865 - Apartment Building...
• 15-PE-2. 50866 - Buy the cheapest
• 15-PE-4. 50868 - Sort Frequencies
• 15-PE-5. 50869 - Birthday Celebration
• 15-PE-7. 50871 - Harmonic Mean
• 15-PE-8. 50872 - Top M Grades
• 15-PE2-1. 50980 - The smallest rect...
• 15-PE2-2. 50981 - Top popular m-st...

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

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

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

Buy 3, Pay 2

Question: The company that you work started a new promotional season. People buy any three items, and they don't pay for the cheapest item (of the three). Write a program that reads product information for n items and calculates the minimum amount (for the customer) to pay. Pay attention that the items may be grouped differently and different results may come. For example if you are given the prices: 5 5 3 4 2 1 and if you process with the groups: (5 5 3) (4 2 1), the customer has to pay $16. However, if you group (5 4 5) (3 2 1), the customer has to pay $15. Find the minimum total amount to pay.

Input specification
You will be first given a number n, the number of numbers where 0 ≤ n ≤ 10,000. Then, in the following n lines, you will be given n numbers where the numbers are floating point numbers between 0 and 10,000. Please note that n does not have to be a multiple of three.

Output specification:
Show the result with digits precision: minimum total amount to pay.

Sample Input I
6
5
5
3
4
2
1
Sample Input II
4
3
7.2
4
5
Sample Output I
15.00
Sample Output II
15.20

Explanation (for Sample input 2): If you group, 7 5 and 4, $4 will be free. Because there is no other triple, he has to pay for: 7+5+3 = $15



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

www.contester.ru