I. 352. The figure (``Példa a lakótelepre'') shows a rectangular area consisting of \(\displaystyle N\times M\) (\(\displaystyle 2\le N, M\le 50\)) tower blocks viewed from above.
The horizontal cross sections of the towers are identical squares. The number of levels of a tower block can vary between 1 and 9. On each level of each tower block there is exactly one flat. Create your program i352 to answer the following questions by using data from the file telep.txt. Before writing any result to the screen, the number of the actual task (for example, Task #3:) should be displayed. If the user is prompted to enter any data, then the type of this requested input should also be shown. Diacritical marks in the output may be omitted. The first line of the file telep.txt contains the values of \(\displaystyle N\) and \(\displaystyle M\); the following \(\displaystyle N\) lines describe the number of levels of each tower block; and the last line of the file contains a one-letter abbreviation of the colors used to paint the tower blocks. The example ``Példa telep.txt fájl'' shows a sample telep.txt file: the string ``fszn'' abbreviates the colors ``fehér'' (white), ``sárga'' (yellow), ``zöld'' (green) and ``narancs'' (orange).
1. Read the data from the file telep.txt and solve the following tasks.
2. Determine the percentage of the flats that are located in a tower having \(\displaystyle 1,2,\dots,9\) levels. You should use two decimal digits and the following format:
3. Give the number of flats with a 360-degree panorama. A flat has a 360-degree panorama, if the view is not blocked in any of the four directions (vertical or horizontal, if the tower blocks are viewed from above). Flats on the same or higher levels of other towers block the view in a given direction.
During remodeling, vertical stripes are painted on the towers in a way that consecutive levels of a tower will have the colors specified by the last line of the input file. Colors should be used in the given order and cyclically: they begin painting the tower in the top-left corner of the map, from its bottom level to the top, then proceed with the other towers in the same row of the map from left to right, and do this for each row. The color of the first level of a new tower should be the next color in the list following the color of the topmost level of the previous tower just completed.
4. You should write the colors of the topmost level of each tower to the output file felso.txt as specified by the example ``Példa kimeneti felso.txt fájl''.
5. It is important in the design of the area not to have neighboring towers with too similar colors. Prompt the user to enter a pair of coordinates representing the row and column coordinates of a tower relative to the top-left corner of the map (``Példa bemenet'' in the example), then determine whether there is a neighboring tower whose coloring begins in the same way from its bottom level up (but ignoring the number of levels of the two towers): ``Van'' in the output (= ``Kimenet'') means there is a neighboring tower with this property, and ``Nincs'' means there is no such neighbor.
6. They place a roof advertisement as a new level on the top of the tower specified by the user input of the previous task. You should determine the number of flats from which this advertisement can be seen. Recall from Task 3 that flats on the same or higher levels of other towers block the view in a given direction (vertical or horizontal, if the map is viewed from above).
The source code (i352.pas, i352.cpp, ...) of your program and a brief documentation (i352.txt, i352.pdf, ...) of your solution should be submitted in a compressed file i352.zip, also specifying the name of the developer environment to use for compiling your source.
Downloadable file: telep.txt
Deadline expired on 10 October 2014.