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

Разделы > Поиск > задача:


50450 - Last Appereance of a Number

Гость
• Обсуждение задачи (1)

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

• 50834 - The train which leaves the f...
• 51078 - Max trade
• 51056 - Welcome Picnic
• 51055 - The competition
• 51077 - Grades Histogram
• 51057 - Number of students
• 51046 - The biggest number
• 50535 - Image Compression
• 50450 - Last Appereance of a N...
• 50457 - The Number of Winners
• 50453 - The Cubic Difference
• 50451 - Processing Cost
• 50459 - The Biggest Digit
• 50538 - Sum of kth Diagonal
• 50465 - How many students have p...
• 50378 - Sum of the given digits
• 50470 - Close Pairs - Revised

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

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

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Question by Ibrahim Mesecan. Сложность Бета

Last appearance of a number

You will be given a number (num), and a list of numbers (lst) with n elements. Search the number (num) in list (lst), if it exists in the list, return its position, show -1, if it's not in the list. If the searching number appears several times, then show the last appearance of it.

Input specification
You will be given two integers (num, n) where 1 ≤ n ≤ 50000 and -100000 ≤ num ≤ 100000. Then in the following n lines you will be given n numbers which are between -100000 and 100000.

Output specification
Show the last appearance of the searching number, if it exists in the list. Show -1 otherwise.
NoteThe position of the first number is 1.

Sample Input I
  3 6
  2
  7
  2
  4
  -10
  20
Sample Input II
  -2 10
  2
  7
  -2
  -4
  4
  -10
  -6
  3
  -2
  7
Sample Output I
  -1
Sample Output II
  9


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

www.contester.ru