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

Problem S. 25. (March 2007)

S. 25. L-shaped tiles are sold in a furniture shop. Every tile has one corner element, at least one but at most three line elements and two terminating elements at both ends. The first column of the following table contains the line elements, the following two columns the possible corner elements, while the last two columns the terminating elements together with their ASCII codes.

Write a program that asks for sidelengths of a rectangle in the command line (for example, s25.exe 4 2 in the case of a 4×2 rectangle), then prints tiling of the full rectangle when the smallest possible number of tiles are cut. The output of your program (on a text screen) is an arrangement of the tiles in each line separated by spaces: first, by using the given characters then the corresponding ASCII codes. The result for the previous 4×2 rectangle is

As a further example, a possible tile is

And the tiling of a 2×5 rectangle (without cutting any tiles):

Tiling of a 6×6 rectangle (again, without any cutting):

The source code of the program (s25.pas, s25.cpp, ...) and a short documentation (s25.txt, s25.pdf) are to be submitted.

(10 pont)

Deadline expired on April 16, 2007.


Sorry, the solution is available only in Hungarian. Google translation

Ez a feladat kicsit nehézre sikeredett. Arra bátorítanék mindenkit, hogy ilyen esetekben részfeladatok megvalósítását küldje be, pár pontot így is el lehet csípni.

Lássuk Györök Péter12. évf. Táncsics Mihály Gimnázium, Kaposvár megoldását: (Viszonylag kevés Delphi megoldás érkezik, ezért is szerettem volna ezt kiemelni)

Az előállítás során alapesetekből indulunk ki. 1 sor esetén nem készíthetünk egész csempét. 2 sor esetén az 1, 2, 3 és 7 szélesség kivételével mindegyik kirakható két csempéből álló blokkokból. 3 sornál az első két sort a 2 sor alapesetével rakjuk ki, kivéve a 7*3-ast, amelyben a 7. oszlopba még egy csempe belefér, amelynek a lelógó része a 3. sorban helyezkedik el. 4 vagy több sornál tulajdonképpen külön 2 soros alapeseteket kell kitölteni. A balszerencsés 7 oszlop esetén az utolsó két oszlopot függőlegesen töltjük ki, mivel a páros hosszú sor kirakható. Az 5*5 és 5*7 kitöltésére egyedi mintákat használunk. A többi páratlan esetben egy sort töredékesen hagyunk az alján, a maradékot pedig páros alapesettel töltjük ki.

Ha a magasság nagyobb a szélességnél, akkor tükrözéssel állítjuk elő. Szintén tükrözünk, ha a magasság páros, de a szélesség páratlan. s25.dpr


Statistics:

3 students sent a solution.
10 points:Györök Péter, Kezes Balázs, Ócsvári Ádám.

Problems in Information Technology of KöMaL, March 2007