Mathematical and Physical Journal
for High Schools
Issued by the MATFUND Foundation
 Already signed up? New to KöMaL?

# Problem I. 157. (April 2007)

I. 157. Regular readers of this Journal may remember our great detective, Watson from Problem I. 134. Those bad guys begin to sense that their business is endangered, so from now they encrypt their messages. Watson wants to prevent further robberies, therefore he should be able to decrypt their messages and encrypt his own ones. Encrypted messages contain only numbers separated by semicolons. Watson also knows that every message is signed by one of the wrongdoers. For example, the sequence

119; 25; 125; 69; 80; 118; 67; 147; 43; 21; 109; 29; 88; 128; 130; 72; 58; 156;

belongs to Hack Er. However, signatures are polymorphic, so

112; 32; 36; 158; 63; 135; 97; 117; 44; 20; 51; 87; 58; 158; 49; 153; 83; 131;

is also Hack Er's signature.

Your task is to find out how the gangster's encryption scheme works, then write a program to help Watson decode existing and encode new messages. Your program has three parameters, the first is either de'' or en'' (meaning decoding or encoding), the second parameter is the name of the file to read, while the third parameter is the name of the converted message file, as in the following example: i157 de secret.txt plaintext.txt.

The source code of your program (i157.pas, i157.cpp, ) should be submitted.

(10 pont)

Deadline expired on May 15, 2007.

Sorry, the solution is available only in Hungarian. Google translation

Ha jól emlékszem, régen tettem közzé C++ megoldást, legyen akkor most ez:

Véges Márton, (Budapest, Fazekas Mihály Gimnázium) megoldása:

### Statistics:

 13 students sent a solution. 10 points: Balambér Dávid, Biró János, Czigler András, Danka Miklós András, Földes Imre, Györök Péter, Polgárfi Bálint, Ridinger Tamás, Szoldatics András, Véges Márton, Vincze János. 8 points: 1 student. 5 points: 1 student.

Problems in Information Technology of KöMaL, April 2007