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

Турниры > CEN303 2013-15 Questions > задача:


15PrE-40. 50819 - Linked Numbers

CEN303 2013-15 Questions

Старт: 15.дек.2013 в 14:00:00
Финиш: 15.дек.2013 в 19:00:00
Турнир завершён!
• Турнирная таблица

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

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

• 15HW-50. 50830 - Sorting BST Nodes
• 15HW-60. 50678 - The Jumping Rabbit
• 15MdE-10. 50802 - Comparing Exams
• 15MdE-20. 50803 - Sum of the dept...
• 15MdE-40. 50805 - Sum of the weig...
• 15PrE-10. 50816 - Largest Sum Path
• 15PrE-20. 50817 - The Knight Move
• 15PrE-30. 50818 - Depth Limited BST
• 15PrE-40. 50819 - Linked Numb...
• 15PrE2-01. 50847 - The first m train...
• 15PrE2-06. 50837 - Sum is equal to K
• 15Rst-10. 50857 - Nine-Stones Game
• 2.15FE-03. 50996 - Checkers - the ...

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

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

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

Linked Numbers

Assume that you are given the n numbers. Find the maximum length of number ordering such that the last digit of one number (an) is the same as the first digit of the next number (an+1). For example the following series complies the Linked Numbers property:

  12 235 514 
However the following series does not:
   12 235 415 
because second number 235 ends with 5, but the third number 415 starts with 4.

Question: You will be given n positive integer. By possible replacements, find the length of longest linked numbers.

Input specification
In the first line, you will be given a number: The number of numbers(n) 1 ≤ n ≤ 30. Then, in the following n lines, you will be given n integers which are between 0 and 12,000.

Output specification
Show the length of the longest linked list

Sample Input
4
235
12
317
514
Sample Output
3



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

www.contester.ru