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

Сборники > Kovrov IT > задача:


50823 - Secret Number

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

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

• 50516 - Lines
• 50446 - Snake
• 50875 - Take m-out
• 50786 - Top Question
• 50788 - Eight Puzzle
• 50509 - Reading Book
• 50529 - Row to Table
• 50499 - Table to Row
• 50823 - Secret Number
• 50853 - Parking Place
• 50496 - Falling Bricks
• 50802 - Comparing Exams
• 50785 - Swimming Contest
• 50866 - Buy the cheapest
• 50517 - Confusion Matrix
• 50515 - Lines - Revisited
• 50999 - Overlapping Trips

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

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

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

Secret Number

Agent Genti has brought you a secret message. You have to decode the message and find the number (a telephone number or any secret number that you need) in it. You know the secret function:

a[x-1] = b * a[x+1] - c
where b and c are the numbers given. And the secret message will be sent later.

The message is a series of numbers and the message is hidden on the positions comply the given function. You need to take the last digit of these numbers (a[x]) to form the new number. Then, you multiply the number with k to get the secret number. Note: : The number might have at most seven digits, so, if there are more than 7 digits, take the first 7 digits.

Input specification
You are firstly given 4 numbers: The number of numbers (n) and the numbers b, c and k. Then in the following n lines, you will be given n numbers where each of the number is between -3e4 and 3e4, 1 ≤ n ≤ 40,000 and 0 ≤ (b, c and k) ≤ 20.

Output specification:
Show the secret number.

Sample Input I
10 2 9 3
37
7
23
8
13
15
-16
12
13
42
Sample Input II
10 3 5 3
79
88
55
31
28
78
11
64
83
23
Sample Output I
2208
Sample Output II
1749

Explanation:

  1. a[0] = 37, a[1] = 7, a[2] = 23, b = 2 and c = 9 . And because 37 = 2 * 23 - 9, the first number is 7 and its last digit is 7.
  2. Because 7 = 2*8 - 9 , the second number is 23: (and its last digit 3 is taken)
  3. Lastly 15 = 2 * 12 - 9, so, the third number is -16. And, its last digit 6 is taken.
Then the number 736 is formed. In order to find the searching number this number is multiplied with k and we have the secret message: 2208.



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

www.contester.ru