HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Contests > CEN111 Homeworks 2013-2015 > problem:


15-FallHW-4. 50823 - Secret Number

CEN111 Homeworks 2013-2015

Start: Jan.10.2015 at 10:00:00 AM
Finish: Jan.10.2015 at 03:00:00 PM
The contest is finished!
• Contest scoreboard

Guest
• Review clarifications (2)

Contest problems

• 14-Fall2-60. 50487 - Radius of Inscr...
• 14-FallResit-20. 50407 - Missing Nu...
• 14-Spr2-10. 50426 - Calculating Sales
• 14-Spr2-20. 50425 - Calculating W...
• 14-Spr2-30. 50445 - Cryptography
• 14-Spr2-50. 50437 - Age Labeling
• 15-FallHW-2. 50821 - Derivative of ...
• 15-FallHW-3. 50822 - Linked List
• 15-FallHW-4. 50823 - Secret N...
• 15-FallHW-5. 50824 - Sum of Group...
• 15-FallHW-6. 50825 - Drawing Polygon
• 15-FallPr-10. 50808 - Total Distance...
• 15-FallPr-50. 50812 - Total Discount...
• 15-FallPr-70. 50814 - Buying Books f...
• 15-FallPr-80. 50815 - Breaking the ...
• 15-FallRE-10. 50853 - Parking Place
• 15-FallRE-20. 50854 - Area of Trian...

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