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

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


51019 - Finding the hidden message

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

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

• 50520 - Filling a Matrix Randomly
• 50497 - Falling Bricks - Revisited
• 50847 - The first m trains to leave
• 50669 - Area of an Irregular Polygon
• 50860 - Number of Student Certificates
• 50444 - n digit kth number divisible...
• 50865 - Apartment Building Adminis...
• 51011 - Decoding the Path
• 51019 - Finding the hidden mes...
• 51002 - The most successful classes
• 50525 - Ordering Pizza
• 50342 - 100 Factorial
• 50524 - Elevator
• 50531 - File Decryption
• 50758 - National Elections - Revisited
• 50687 - Pascal Triangle - 2
• 50756 - Average of the Nth Student

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

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