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

Problem I. 376. (May 2015)

I. 376. Crossword puzzles are popular games and have many variants. In its usual form, words are separated by black squares. When words are entered correctly, solutions can be read horizontally from left to right and vertically from top to bottom. The numbering of the squares begins in the top left corner where the first horizontal or vertical solution word should start, then each square in the puzzle is numbered where a horizontal or vertical word starts. The puzzles in our task do not contain words with one letter. If a square contains the first letter of a word that is simultaneously a horizontal and a vertical solution, then the square gets only one number.

The example shows an empty crossword and its numbered counterpart.

To test your solution, the halo.txt file can be downloaded from our web site, containing the description of a crossword of size \(\displaystyle N\times M\) (\(\displaystyle 5\le N, M\le 15\)). The first line of the file contains the values of \(\displaystyle N\) and \(\displaystyle M\) separated by a space. The following \(\displaystyle N\) lines describe the squares: the characters ``f'' and ''.'' represent the black and the empty squares, respectively.

Your program i376 should solve the following tasks.

If an output is displayed on the screen, the number of the actual task should also appear. Whenever the program prompts the user to enter some data, the type of data should also be displayed; for example, in the 4th task: ``Task #4 - Please enter the coordinates of a square: ''. Diacritical marks in the output can be omitted.

1. By using the data read from the file halo.txt, solve the following tasks.

2. Display on the screen the number of black and the number of empty squares in the puzzle.

3. Determine which row contains the most black squares. If there is more than one such row, the one with the smallest row number should be displayed. Then repeat this counting for the columns.

4. Prompt the user to enter the coordinates of a square in the crossword (e.g. 10h), then display whether it will get a number or not.

5. Display on the screen the number of words with letters \(\displaystyle 2, 3,\dots, 10\) that can be placed horizontally in the puzzle.

6. Number the squares in the puzzle according to the rules, then write the result into the file szamozott.txt. The content of each square should occupy 3 characters (see the ``Példa'' example below).

7. Display the number of definitions corresponding to the horizontal and to the vertical words.

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

Downloadable file: halo.txt

(10 pont)

Deadline expired on June 10, 2015.


Statistics:

13 students sent a solution.
10 points:Fényes Balázs, Kazal Soma, Kovács 246 Benedek, Mócsy Miklós, Nagy Ábel, Olexó Gergely, Radnai Bálint, Rittgasszer Ákos, Szemerédi Levente.
9 points:Kovács Balázs Marcell.
8 points:1 student.
6 points:1 student.
5 points:1 student.

Problems in Information Technology of KöMaL, May 2015