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

Разделы > Linear Data Structures: Arrays > задача:


51019 - Finding the hidden message

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

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

• 50982 - A thief in labyrinth
• 51091 - Guess the number - 1
• 51008 - Sum of Regional Maxes
• 50989 - Rectangles and Points
• 51020 - Number of nodes removed
• 50932 - Shifting rows and columns
• 51141 - Most valuable stock items
• 51014 - Nine Men's Morris game
• 51019 - Finding the hidden mes...
• 50497 - Falling Bricks - Revisited
• 50933 - Sum of the Biggest Neighbors
• 51100 - Minimum time to exit building
• 50444 - n digit kth number divisible...
• 50865 - Apartment Building Adminis...
• 51089 - Multiply a row and add it to ...
• 50874 - Apartment Building Adminis...
• 50531 - File Decryption

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

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

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

Finding the hidden message

Your friend needs some support in his exam. You will send him a message hidden in a matrix. Only you and your friend know the starting position. Then you will encode the message in the following way.

The matrix is a 2D integer array. Assume that the first byte is the least significant byte of the integer number. int num =(B4 B3 B2 B1). The first byte (B1) contains a hidden char, the next two bytes (B2 and B3) of every number is encoded in a way so that you can get the x (B2) and y (B3) coordinate of the next position in the array. You know that the message stops when B1 = (B2+B3).

Question: Write a program that reads a 2D matrix and prints the hidden message.

Input specification: You will be given three integers (n) in the beginning, and the starting coordinate (x, y) of the message. The following n lines will have n integers where 0 < n ≤ 100 and matrix values are integers less than 2e9. Note: array positions are integers between 1 and n.

Output specification: Show the hidden message.

Sample Input
5 2 4
786698 328276 197199 1982337 4544789
263506 5919586 4656938 66133 145576
2894514 263245 3213120 1927649 3492114
2237893 66371 5335242 132176 263433
5136373 131397 2193877 1787826 4921748
Sample Output
COMPUTER

Explanation: The matrix is 5 by 5, and you know that you will start from (2,4). The number (66371)10 is (10000001101000011) 2 where first byte is 67 = (01000011)2 which is the char 'C' in the ASCII table. The second byte is 3 (00000011)2 which is the x coordinate of the next char. The third byte is 1 = (00000001)2, the y coordinate of the next char. Thus, the second char is hidden in (3,1): (197199)10 is (110000001001001111) 2, and the hidden char is 79 = (001001111)2 which is the char 'O' in the ASCII table.

The char at (1,2) is 'R' and it points to (5,4) where the secret message ends because B1 = B2 + B3 (263433)10 is (100 00000101 00001001)2.



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

www.contester.ru