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

Problem I. 391. (January 2016)

I. 391. The Cucumber Domestication Institute celebrates its \(\displaystyle 10^{\textrm{th}}\) anniversary so they carefully measured and recorded the heights of their nice cucumber trees located on the two sides of a pathway.

The cucumber tree heights in centimeters are found in the UTF-8 encoded and tabulator-separated text file fak.txt (downloadable from our site). Each line contains two tree heights (the numbering starts from 1), the heights of the left and right trees, respectively. In the example, the height of the tree 1B (first row, left side) is 4667 cm, while that of the tree 2J (second row, right side) is 7647 cm.

Your program i391 should solve the following tasks. When displaying data on the screen, you should also display the task number.

1. Read the cucumber tree data from the file, and display the number of trees on both sides of the pathway using the layout in the example.

2. What is the average tree height? How many trees are there on the left and on the right sides that are higher than the average? You should use the same layout as in the example, and use two decimal digits.

3. Any of the highest trees is called the pride of the institute. Find all of them and display their coordinates according to the example.

4. A tree is called the disgrace of the institute if it has two neighbors and it is smaller than any of those. The Institute will pay more attention to these trees in the future. According to the sample, display the coordinates of the highest tree(s) being the disgrace of the institute.

5. During the celebrations the 10 highest trees will play a prominent role. Display the coordinates of these according to the sample. You should display data corresponding to exactly 10 trees even if there is a "tie".

Ubul, the little monkey of the Institute, likes hopping on the treetops. Ubul always starts from the first tree of the left side, and either hops onto a tree on the same side or jumps onto a tree on the other side having the same row number. Ubul never returns to its earlier position.

6. On one occasion, Ubul always chooses the higher tree out of the two possibilities to jump on. (If both trees have the same height, Ubul stays on the same side.) The first line of the file ubul.txt should contain the tree names (separated by a space) visited by Ubul in order.

7. On another occasion, Ubul's path contains monotonically increasing trees until it is impossible to continue this way. If the path no longer leads upward, Ubul changes direction and jump monotonically down as long as it is possible. Then changes direction again, and so on. If both possible target trees are higher (or both smaller, or both have the same height), then Ubul stays on the same side. The second line of the file ubul.txt should contain Ubul's path (separated by spaces). The third line of the file should contain the total elevation and depression of Ubul in cm during its path.

The source code and a short documentation of your program—containing a brief description of your solution, and the name of the developer environment to compile your code—should be submitted in a compressed file i391.zip.

Sample:

Downloadable file: fak.txt

(10 pont)

Deadline expired on February 10, 2016.


Statistics:

8 students sent a solution.
10 points:Kovács 246 Benedek, Nagy Ábel, Olexó Gergely.
9 points:Hamrik Szabin, Radnai Bálint.
8 points:1 student.
7 points:2 students.

Problems in Information Technology of KöMaL, January 2016