Problem I. 232. (February 2010)
I. 232. In this exercise a simple model of communication over the Internet by using packets is described.
Typical communication software breaks messages of communicating parties into pieces of standard size and appends some auxiliary data necessary for the transmission. These packets are then sent through the appropriate channels. Packets may arrive to the recipient in a different order they were sent.
The structure of each packet containing pieces of messages is as follows.
||identifier of the sender, positive integer, at most 100;
||identifier of the recipient, positive integer, at most 100;
||a unique number, at most
|number of the fragment
||gives the number of the fragment of the actual message, the number of the first fragment is 1, and numbering is sequential;
|part of the message
||consists of exactly 10 characters. The last significant character of the message is followed by at least one filter character (|) so that the total length of the piece is always 10 characters. (Messages consist of lower and uppercase characters of the English alphabet, digits, punctuation marks, hyphens and spaces.) Instead of the space characters however, an underscore is used for simplicity;
||is the remainder upon dividing the sum of the above 4 numbers and ASCII codes of message characters of the packet by 100.
We test this network model by writing all incoming pieces of messages into the file naplo.txt, shown in the example.
The first line of the example shows that Station 11 has sent a message to Station 3. The message identifier is 334. The actual packet contains the second fragment of this message. Since we see a filter character (|), we know that this is the last piece of the message.
Write your program halo to answer the following questions. Your program should process each correct input file. Display the number of each task as well. If your program needs user input, print the corresponding query in detail (in the fifth task, for example: ''5th task: Enter the message text''). You may omit diacritical marks when displaying messages on the screen.
Read the file naplo.txt (naplo.txt) and use that information to solve the following questions. If, for some reasons the file can not be read, enter data for 10 messages manually and use that in the following.
Display on the screen the number of messages Station 4 sent to Station 5.
Display on the screen numbers of those lines with invalid checksum, separated by a space. Otherwise display ``All checksums were correct.''
By processing the file naplo.txt, recover the original messages. Each line of the file eredeti.txt should contain one message and its structure should be similar to our second example. (The second example shows a possible beginning of eredeti.txt that would correspond to our first input example.) Messages can be given in an arbitrary order.
11 3 334 KoMaL_pontverseny ...
Decompose a message of the user into packets. The user should also specify the source and destination Stations. Each packet should be displayed on the screen in separate lines. Be careful to produce a unique (but otherwise arbitrary) message identifier to avoid naming collisions.
The source code (i232.pas, i232.cpp, ...) together with a short documentation (i232.txt, i232.pdf, ...) -- also describing which developer environment to use for compiling, further a brief description of your solution -- should be submitted in a compressed file (i232.zip).
Deadline expired on 10 March 2010.
Sorry, the solution is available only in Hungarian. Google translation
Ez egy érettségi típusú programozási feladat volt, ezért az értékelési útmutatót közöljük. i232ertekeles.pdf
A KöMaL pontverseny pontszámai természetesen a fenti dokumentumban olvasható pontok konvertálásával születtek.
A megoldások pontszám szerint átlagosan jól sikerültek, de nagyon sok apró pontatlanságot, ésszerűtlen részmegoldást tartalmaztak.