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

Турниры > CEN254 Final Exam > задача:


1. 51142 - Jump Min Value

CEN254 Final Exam

Старт: 23.июня.2017 в 12:25:00
Финиш: 23.июня.2017 в 13:25:00
Турнир завершён!
• Турнирная таблица

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

• 1. 51142 - Jump Min Value
• 2. 51143 - Departments Competition
• 3. 51082 - Sum is equal to K - 1
• 4. 51145 - Graduation Exam

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

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

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

Jump Min Value

Tommy and his friends are playing a game. In the game, there is a series of random numbers. And, they want to start from the beginning and reach to the end while jumping over at most one consecutive number. For example if there is a number series: 2 3 4 5, it is possible jump over 2 and 4 (image 2 on the right JMV=8), or 3 and 5 (image 1 on the right with JMV=6). But, not 2 and 3 (image 3) or 4 and 5 (image 4) (no two consecutive numbers). It is also possible not to jump and continue to the next number.

Question: Write a program that reads a number series and decides the min jump value.

Input specification: You will be given an integer in the first line (n) number of numbers. In the second line you will be given a (n) positive integers where 1 ≤ n ≤ 30.

Output specification: Show one integer: min jump value.

Sample Input 1 Sample Input 2
4
2 3 4 5
6
9 6 19 13 3 14
Sample Output 1 Sample Output 2
6 22

Explanation for sample input 2: Tommy can jump over 9 and 19 and 14. Thus he steps on 6 + 13 + 3 = 22.



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

www.contester.ru