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

KöMaL Problems in Informatics, January 2010

Please read the rules of the competition.

Show/hide problems of signs:

Problems with sign 'I'

Deadline expired on February 10, 2010.

I. 229. Besides conventional guns, their electronic versions are also used in sport shooting trainings. In these simulations, the targets are placed on screens, and coordinates of shots are stored and evaluated electronically.

Initially, coordinates of the middle of the target (cx,cy) are stored, then -- in the same coordinate system -- horizontal and vertical coordinates of each shot (lx,ly) are recorded. The score for the shot is determined by its distance from the centre:

-- First, differences of the corresponding coordinates x=lx-cx and y=ly-cy are formed.

-- If the center of the target is hit, the shot is worth the maximum 10 points. If this is not the case, the score is decreased according to the formula 10-\sqrt{x^2+y^2}.

-- If this number is negative, then the score is zero.

-- The score is finally rounded to two decimals.

The first line of the file lolap.txt (downloadable from here) contains the number of shots N (3\leN\le500), while the second line contains coordinates of the center of the target cx, cy (25.00\lecx,cy\le75.00). The following N lines then store coordinates of consecutive shots lx, ly (0.00\lelx,ly\le100.00).

28.95 31.60
23.67 30.18
35.12 50.27
30.45 34.67

Numbers is in example should be interpreted as follows:

-- 65 shots are evaluated

-- the centre of the target is located at (28.95,31.60)

-- the first shot has x=23.67-28.95=-5.28 and y=30.18-31.60=-1.42 values, therefore the corresponding score \textstyle 10-\sqrt{{(-5.28)}^2+ {(-1.42)}^2} rounded to 2 digits is 4.53

-- the second shot has score 0.

Your program loveszet should solve the following tasks. If a task requires screen output, display the number of that task as well (e.g., Task #3: ). Scores for shots should be rounded to 2 decimal digits, no other digits should be visible.

1. Read the file lolap.txt and use that information to solve the following questions. (If, for some reasons, the file can not be read, enter 10 lines manually and use that data in the following.)

2. Print the number and score of the highest shot.

3. To measure the quality of aiming at the target, list the number of shots with 0 score.

4.Determine which 10 consecutive shots have the highest average score. Display the number of the first shot of such a group.

5. Shots of a shooter may tend to be biased in a certain direction. By neglecting shots with 0 score, your program should display the number of shots in each quadrant, in a format similar to the following: 1st quadrant: 13 shot(s), 2nd quadrant: 18 shot(s), ... (The first quadrant consists of points with nonnegative coordinates. The third quadrant has points with both coordinates strictly negative. The rest of the points in the upper left and lower right part of the coordinate system form the second and fourth quadrants, respectively.)

6. Decide whether there have been 4 consecutive shots hitting the four quadrants in increasing order.

7. Ask the user to enter a score, then compute the length of the longest run of shots with scores greater than or equal to the given number.

The source code (i229.pas, i229.cpp, ...) together with a short documentation (i229.txt, i229.pdf, ...) -- also describing which developer environment to use for compiling, further a brief description of your solution -- should be submitted in a compressed file (

(10 pont)

solution (in Hungarian), statistics

I. 230. Your task is to design a relational database describing data of the KöMaL Contest. The structure of the database should be devised so that the following questions can be answered (not necessarily by one query).

* Which problems were proposed in April 2008?

* Who submitted solutions to Problem I. 220?

* How many competitors submitted solutions to Problems of type I?

* How many points were awarded by a given set of competitors in the academic year 2007--2008?

* Who were the competitors from a given set of schools?

* Who submitted a solution to an I-problem that was awarded the highest score?

* What was the final result in Category S in the academic year 2008--2009?

These questions are only for orientation, you do not actually have to answer them.

In your solution, the following steps should be followed.

* Determine which data to store. (You should recollect the registration process to KöMaL, further, results of the contest may be of help. You can ignore the name of the proposer of the problem, the content of the problem and the name of the person who corrected the problem.)

* Determine the individuals and assign the appropriate attributes to them.

* Mark the keys and determine the relations between individuals. (The corresponding figure should be included.)

* Describe the structure of the tables, further, the role and type of the fields.

Your solution should describe individuals (tables) and the corresponding attributes (fields), similarly to our earlier Problem I. 218.

You should also create a figure displaying the structure of the database. You can refer to the figure in Problem I. 218. The figure should be easily modifiable. It is advisable to use a freely available or multiplatform program for editing.

A document (i230.doc, i230.pdf, ...) containing your solution together with a figure showing the structure of the database should be submitted in a compressed file ( You should also give the exact name of the program used to create the figure. The figure should be saved in the program's own format.

(10 pont)


I. 231. When creating loudspeaker announcements for public transportation vehicles or railway stations, complete sentences are rarely recorded, only words or sentence fragments, so by editing these sound files with appropriate programs it is possible to create a large number of different announcement texts.

The file (downloadable from here) contains such a collection of sound samples in wav format, including an ``attention'' sound signal played before announcements.

By using these samples, you should create two sound files containing a railway station announcement, one general announcement about train departures and one last call before the departure of a particular train. The attention signal should be put before both announcements.

You may use, for example, the freely downloadable sound editor Audacity (

In the example, ``Állománynév'' is the name of the file, while ``Szöveg'' is the text (containing announcements often heard in Hungarian railway stations).

The two sound files together with a short documentation (i231.txt, i231.pdf, ...) of your solution should be submitted in a compressed file (

(10 pont)

solution (in Hungarian), statistics

Problems with sign 'S'

Deadline expired on February 10, 2010.

S. 50. Approximately 5000 fans of a basketball team filled out a one-page survey about the popularity of the team (the file urlapminta.pdf is downloadable from our web page). Each survey contained 12 answers.

Now the team asks for your help in evaluating these surveys. Fortunately, you do not have to process these sheets manually, so

1. the sheets are digitalized by a desktop scanner, then

2. images are processed by a suitable program.

We all know that this task is not easy due to the following reasons:

1. The desktop scanner may not scan the originally identical surveys in exactly the same way, (very) small offsets may occur.

2. People used pens in different colours, and different check marks or x marks.

3. Some fans might have missed checking an answer, or gave more than one to a question.

For testing purposes, you are given 10 files in RAW format with image size X×Y.

Your program should read the name of the image file (located in the same folder as your program) from the standard input, then display the possible answers 1, 2, 3 or 4 to each question on the sheets, separated by semicolons on the standard output. If your program thinks that no answers were selected, print a letter N, while if multiple answers were given, print a letter D.

During the evaluation of your program, 2 points will be awarded if the given sample files are processed correctly. Further 3 points will be given if your program correctly recognizes at least 90% of the answers on a rescanned version of the sheets. More 3 points will be earned, if your program correctly recognizes at least 80% of the answers on 10, previously unknown answer sheets. The remaining 2 points are given for proper documentation of your program.

Source files:

The blank is printed from the following pdf file: urlapminta.pdf

The source code (s50.pas, s50.cpp, ...) together with a short documentation (s50.txt, s50.pdf, ...) -- also describing which developer environment to use for compiling, further a brief description of your solution -- should be submitted in a compressed file (

(10 pont)

solution (in Hungarian), statistics


Upload your solutions above