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

Problem I. 161. (May 2007)

I. 161. Your task in this exercise is to simulate lightnings on the screen. The available display size is given as a command line parameter to your program (e.g. i161.exe 30 20 means 30 characters horizontally and 20 vertically). First you should fill the display area by random integers between 1 and 9. Then - by taking into account the three uppermost lines of the display - find the column(s) with the greatest sum of numbers: the lightning(s) will start from here. From the third line on, the lightning can propagate in three directions: horizontally, vertically, or diagonally down, by selecting the largest number from the appropriate neighbouring cell. (If there are more than one adjacent largest numbers, the lightning forks.) If it hits the (bottom or side) edge of the display area, the lighting discharges. Numbers along the path of the lightning should be changed to yellow. The example shows a 10×10 display area, now with letter ``V''s instead of yellow numbers.

The source code of your program (i161.pas, i161.cpp, ...) should be submitted.

(10 pont)

Deadline expired on June 15, 2007.

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

Balambér Dávid 12. évf.(Budapest, Fazekas Mihály Főv. Gyak. Gimn.) megoldása.



12 students sent a solution.
10 points:Balambér Dávid, Danka Miklós András, Fábián András, Földes Imre, Gilián Zoltán, Györök Péter, Polgárfi Bálint, Ridinger Tamás, Szoldatics András, Véges Márton, Vincze János.
9 points:Kovács 129 Péter.

Problems in Information Technology of KöMaL, May 2007