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

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


51142 - Jump Min Value

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

• 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
• 50711 - Snail Trails

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

Если у вас есть предложения или пожелания по работе 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