HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Array and Matrices > problem:


50823 - Secret Number

Guest
• Review clarifications (2)

Volume problems

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

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
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