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

KöMaL Problems in Informatics, November 2006

Please read the rules of the competition.


Show/hide problems of signs:


Problems with sign 'I'

Deadline expired on December 15, 2006.


I. 142. The file I142in.txt contains a few thousand words of length between 5 and 8 characters, one word per line. No two words have the same number of letters of each kind.

The file I142rnd.txt contains 10 words from the previous file, separated by spaces, but with letters of each word arranged in a random order.

Prepare your program to unscramble the words in the file I142rnd.txt. The output file I142out.txt should contain the 10 original words separated by spaces. The file names are fixed, so the program is run without parameters. The data, the program and the output files are (and should be) stored in the same folder.

The source code and an appropriate documentation should be submitted.

(10 pont)

solution (in Hungarian), statistics


I. 143. The spread of an epidemic in a city of population 0<V<1 million is modelled. The following is known about affected people:

- the latency period is 0<L<15 days during which infected people are asymptomatic and do their daily routine work

- infected but still asymptomatic people meet other people, so each infected person infects 0<F<10 other people each day on the average, who should be considered infected from the next day

- after the latency period, each infected person stays at home for 0<B<15 days and avoids contact with others

- once a patient is recovered, he or she begins working again, but can not infect others and can not be infected in the future

- the epidemic originated from a single person, entering the city on the first day of the latency period (that is, he or she was infected on the previous day)

- sooner or later everyone in the city gets infected. The epidemic ends when everyone is recovered.

Prepare your spreadsheet with input parameters V, L, B and F

- giving the number of days (J) the epidemic lasted

- giving on which day (O) the city had the maximum number of infected people, and how many of them (H) stayed at home then

- plotting the number of latent, ill and recovered people, in the same diagram, from the outbreak to the end of the epidemic.

The spreadsheet in default format and with default extension (e.g. i143.xls, i143.xsc, ...) should be submitted.

One of the sheets should contain

- the names and modifiable values of the parameters of the epidemic in cells A1:B4

- the answers to the questions above in cells C1:D3

- other cells should contain the actual computations.

Another sheet should contain a diagram showing the evolution of the epidemic.

(10 pont)

solution (in Hungarian), statistics


I. 144. Make a presentation showing some centers of a triangle. The presentation should end within 5 minutes and should be automatic. Do not use photos, only handmade illustrations. Each slide should be numbered and should contain the name of the author. We should be able to choose a triangle center to study on the first slide. If no choice is made within 5 seconds, an arbitrary center should be displayed. When information on a center is reviewed, we have again 5 seconds to choose between continuing the presentation and returning to the first slide to choose another center. Besides the content, appropriate techniques and the design are also taken into account during evaluation of your solutions.

The presentation (i144.ppt) is to be submitted.

(10 pont)

solution (in Hungarian), statistics


Problems with sign 'S'

Deadline expired on December 15, 2006.


S. 21. The motion of a billiard ball (i.e. a point mass with completely elastic collisions) is studied. The ball moves on a rectangular table with some polygons blocking its way. The ball starts from a given boundary point of the table with a given initial velocity and moves along a straight line until it touches a side or a vertex of a polygon. Upon collision with a side, the velocity component perpendicular to the side changes sign. Collisions with a vertex are considered as if the ball collided with both sides meeting at the vertex. The simulation ends when the ball hits a side of the table.

The input text file of the program contains the coordinates of the table and the polygons. The first line of the file determines the sides of the table, the second line contains the initial position and velocity of the ball, while every other line describes the integer coordinates of the polygons. The input file does not contain empty lines or other data. All coordinates are integers between -1000 and 1000.

Example: the sides of the table are lines x=-200, x=+100, y=-150, y=300, hence the first line of the input file is -200 100 -150 300 (integers separated by spaces). The initial position of the ball is (-200,0) with velocity vector (5,12), so the second line of the input file contains numbers -200 0 5 12.

The table contains a triangle with coordinates (-20,50), (0,-40) and (50,30), so one further line of the input file is -20 50 0 -40 50 30. The sides of polygons are formed by connecting subsequent vertices. The polygon is closed by connecting the last vertex with the first one.

The name of the input file is read from the standard input, so we start the program, for example, by typing S21 input.txt. Your program should graphically display the path of the ball and give the coordinates of the point where it first hits the boundary of the table.

The source code of your program (S21.pas, S21.cpp, \ldots and a short documentation S21.txt should be submitted.

(10 pont)

solution (in Hungarian), statistics


$Var(Body)

Upload your solutions above