English Információ A lap Pontverseny Cikkek Hírek Fórum

Rendelje meg a KöMaL-t!

VersenyVizsga portál

Kísérletek.hu

Matematika oktatási portál

I. 301. Many websites offer a solution for exchanging books. For a Hungarian example, see www.rukkola.hu, but to make such a site successful, a sufficient number of users is necessary. Upon registration one can mark which books are offered and required, then the site helps distributing the books.

Each line of the file csere.txt (downloadable from our webpage) contains data for the offers and requests in a chronological order. Each piece of data within a line is separated by exactly one space: the first piece is the type of the operation (A'' for offers and I'' for requests), then the day of registration of this operation is stored (counted from the creation of the site and is at most 100), finally the identifiers of the book and the user follow (both numbers at most 200). The book identifier does not denote a particular copy, rather the content. The csere.txt file contains at most 2000 lines.

The first few lines of csere.txt are shown in the example.

A 1 83 1
A 1 63 3
I 1 61 11
I 2 63 8
...

Your program (i301.pas, i301.cpp, ...) should be able to solve the following tasks. First the task number should be displayed (e.g. Task #4''), and a message should appear before each input describing the purpose of that input (e.g. Please enter a book identifier:''). Hungarian diacritical marks can be omitted.

[1.] Read and store data from the file csere.txt in an appropriate format.

[2.] Display the number of requests and offers contained in the file.

[3.] Prompt the user to enter a book identifier. Then display who and when requested it first. If still nobody, then print the message No requests for this book yet''.

[4.] Display the identifier of the most popular book (i.e., the book requested by the largest number of people). If there is a draw, every such item should be displayed, separated by a space, further, the book identifier should be followed by the number of requests in parenthesis, for example 18 (21) 3 (21).

[5.] Sometimes it is said in connection with such websites that everybody requests for more books than they offer. Can we justify this statement? Based on the available data display those user identifiers (in one line and separated by a space) who request for at least as many books as they offer.

[6.] The website makes pairs between requests and offers: the first requester will get the first offered copy of that book. Display the book identifier of the book that has been forwarded first, together with the number of days its requester had to wait for.

[7.] Track the route of the books. Each book route should be recorded into one line of the file mozgas.txt. The first item of the line should be the identifier of the day on which the corresponding offer for the request was found, that is, the day on which the given request-offer pair was formed. The second item should be the book identifier, finally the identifier of the offerer and requester are to be displayed. These items should be separated by a tabulator within the line. The lines within the file can be put in any order.

The source code of your program (i301.pas, i301.cpp, ...) should be submitted together with a short documentation (i301.txt, i301.pdf, ...) also describing which developer environment to use for compiling.

(10 points)

Deadline expired on 12 November 2012.

Google Translation (Sorry, the solution is published in Hungarian only.)

Az érettségi feladat megoldása során a beküldők fele nyújtott legalább 90 százalékos teljesítményt.

A könyvmozgásokat leírását igénylő utolsó feladatba sokaknak beletört a bicskája. Egy lehetséges megoldási módszer ehhez a feladathoz: a bemenet sorait a könyv azonosítója, azon belül a bemenet sorazonosítója szerint rendezzük, majd könyvenként megfelelő számban (az igények és ajánlatok közül a kisebbik) elvégezzük a párba állítást.

Az értékelési útmutató: i301ertekeles.pdf

Jákli Aida Karolina megoldása Visual Basic nyelven: i301.vb

Statistics on problem I. 301.
 18 students sent a solution. 10 points: Dobos-Kovács Mihály, Jákli Aida Karolina, Qian Lívia, Varga 256 Erik. 9 points: Fényes Balázs, Gema Barnabás, Németh 017 András, Tegzes Tamás, Tilk Bence. 8 points: 3 students. 7 points: 2 students. 6 points: 2 students. 3 points: 1 student. 2 points: 1 student.

• Problems in Information Technology of KöMaL, October 2012

•  Támogatóink: Morgan Stanley