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

Сборники > Фёдор Меньшиков. Тренировки > задача:


050. 50450 - Last Appereance of a Number

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

Задачи сборника

• 027. Albanian Airlines
• 028. 50483 - Group Total
• 030. 50584 - Pagesa totale
• 033. 50588 - Perpunimi i nje liste n...
• 035. 50573 - Numri dhe shuma
• 040. 50335 - Five Math Operators
• 044. 50597 - Vizatojme Diamante
• 045. 50462 - Class Average (3 Gra...
• 050. 50450 - Last Appereance o...
• 058. 50574 - Numrat Trekendesh
• 060. 50362 - Pythagorean Numbers
• 060. s
• 065. 50394 - Water Bills
• 070. 50465 - How many students h...
• 072. 50473 - Counting Circles Positions
• 074. 50396 - Cinema Tickets - 1
• 075. 50363 - Class GPA Average

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

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