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

# KöMaL Problems in Informatics, April 2005

Show/hide problems of signs:

## Problems with sign 'I'

Deadline expired on May 17, 2005.

I. 103. A square lattice of size mxn (with positive integers m and n) is given and unit square based columns are put onto each square. The front and side views of this bar chart-like solid are represented by the numbers u1, u2, ..., um and v1, v2, ..., vn, where ui and vj denote the heights of the rectangles being shadows of the columns.

Write a program whose input consists of the numbers m, n, further the numbers u1, u2, ..., um and v1, v2, ..., vn (in the same format as in problem I. 100.), then it computes the matrix describing heights of the columns of the (or, a possible) solid of minimal volume. If no such solid exists, your program should mark the inconsistent numbers in the data.

Notice that this is again a converse of problem I. 98., where a matrix describing the heights of individual columns was given and we had to display the front and side views of the solid. Now we have to reconstruct the solid of minimal volume from the front and side views.

A text file (i103.txt) is to be submitted containing the precise description of the algorithm (5 points), further, the detailed justification of the fact that your algorithm always correctly decides whether the/a solid exists, and, if it does, the algorithm produces a solid with required property (8 points). Your program (i103.pas, ...) should also be submitted (4 points).

(17 pont)

statistics

I. 104. Let us fix a natural number n. Do there exist n positive integers such that their sum equals their product?

Write a program (i104.pas, ...) that decides this question, further, if the answer is affirmative, it gives all these n-tuples in increasing order. Your program should be submitted.

(10 pont)

statistics

I. 105. There is a dog exhibition where m dogs in n categories are awarding points: every dog is given an integer between 0 and 10 in every category. These points are immediately entered into a spreadsheet. The (non-mathematician) chairman of the committee would like to know how many categories has the winner dog (= the dog with the most points awarded) won.

(10 pont)

statistics

## Problems with sign 'S'

Deadline expired on May 17, 2005.

S. 8. Write a program which suggests a step in the game five-in-a-row on a 15x15 board, in an arbitrary position.

Read the current state of the board from the standard input. The empty squares, the figures of the machine and of the opponent are denoted by the characters ., O and X, respectively. Write your best next step to the standard output. Rows are represented by the letters A, ..., O, while columns by the numbers 1, ..., 15. (For example, C9 denotes the ninth square in the third row.)

The solutions will be tested on a 2GHz machine. Your program has at most 10 seconds to choose a step. The programs will compete against one another in a tournament; the winner receives at most 10 points - depending on the documentation -, the second one 8 points, and the rest at most 7 points.

See the example.

 Input Output ............... ............... ............... ............... ............... ............... ......O........ ......XXX...... .......O....... ............... ............... ............... ............... ............... ............... ............... H6

(10 pont)

statistics

\$Var(Body)