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

Problem S. 47. (October 2009)

S. 47. Prepare your program to evaluate cells of a spreadsheet, if some simple formulae and certain numerical values are given. The 25 columns of the worksheet are denoted by capital letters of the English alphabet from A to Y, further, there are 100 rows numbered from 1 to 100. Each cell can contain an integer, a real number (given by simple operations), the four basic operations or cell references. The expressions are syntactically correct, they may contain absolute, relative, or mixed cell references. However, cells contain neither exponentials, nor parentheses.

The input file of your program to be read is given as the first argument in the command line.

Only cells with nonzero values should be read (all other cells contain 0). Each line of the input file describes either a single cell, or a group of cells of a rectangular domain. The name of the output file is given as the second command line argument. The output file should contain the evaluated cells: each value should be an integer or a real number rounded to 2 decimal places. The output file should contain only nonzero values of the evaluated spreadsheet, in CSV format, with each line and value separated by semicolons.

In the first example, be01.txt is a sample input, while ki01.csv is the corresponding output.

In the input file, two cells have nonzero values (one integer and one real number). In a third cell we have also computed their arithmetic mean, and added 20, then 0. The third row of the output file, as well as the first cell of the fourth row is empty.

In the second example, the formula in cells A2:A5 with relative reference adds 1 to the value of the cell left to the actual cell and being in the same row, so this formula literally appears in the top left cell of the domain. The same applies to formulae in B2:E5 with mixed reference.

The third example contains some circular references. These values can not be computed and should be denoted by #Kör. Division by zero should be indicated by #NulOszt.

The source code and project files of your solution (without the .exe file or any other auxiliary files generated by the compiler) together with a brief documentation of your solution should be submitted in a compressed file (s47.zip).

(10 pont)

Deadline expired on November 10, 2009.

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

A megoldásokat a következő tesztállományokkal vizsgáltuk: s47teszt.zip

Mintamegoldásként Mokcsay Ádám 12. osztályos Bonyhádi versenyző (s47.zip) és Kovács András szintén 12. osztályos Budaörsi diák (s47csharp.zip) munkáját adjuk közre.

Statistics:

 13 students sent a solution. 10 points: Kovács 125 András, Mokcsay 026 Ádám. 9 points: Adrián Patrik, Éles András, Weisz Gellért. 8 points: 2 students. 6 points: 1 student. 5 points: 1 student. 4 points: 1 student. 2 points: 1 student. 1 point: 2 students.

Problems in Information Technology of KöMaL, October 2009