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

Problem I. 403. (May 2016)

I. 403. The UTF-8 encoded and space-separated text file csucsok.txt contains the name and height of the Hungarian mountain peaks with height at least 700 m, the name of the surrounding mountain range and the GPS coordinates. A mountain range can have several peaks. The data file contains at most 300 entries for peaks. For example:

Here the mountain Hangyás-bérc has two peaks in the file: the first has height 863 m, it is found in the mountain range Börzsöny, its latitude is \(\displaystyle 47.9409^{\circ}\) N and its longitude is \(\displaystyle 18.9366^\circ\) E.

The data file contains diacritical marks and the decimal mark is the comma. It is allowed, by using Notepad for example, to remove the diacritical marks, or to replace the comma as decimal mark with decimal point everywhere.

Create a program i403 to solve the following tasks. When displaying a result, your program should also print the task number.

1. Read the peak data from the file and display the number of peaks in the data file.

2. Prompt the user to enter the first few letters of a mountain range, then display the corresponding data for the peak(s). If there is no such mountain range, your program should issue a warning. (For example, if the user enters ``Hangyá'', then all peaks starting with ``Hangyá'' should be displayed.)

3. Prompt the user to enter the name of a mountain range, then display the name and height of its highest peak. If there is no such mountain range in the data file, your program should issue a warning.

4. List in alphabetical order all mountain ranges in the data file exactly once. Beside each range the number of its peaks with height at least 700 m should appear.

5. Prompt the user to enter the name of a peak, then determine its distance from the Gellért-hegy with coordinates \(\displaystyle 47.483\,736\,2^\circ\) N and \(\displaystyle 19.037\,055^\circ\) E. You can use the Haversine formula ( to determine the great-circle distance of two points given their GPS coordinates. You should ignore the height difference of the peaks. The radius of the Earth is 6371 km.

6. Determine the two peaks whose distance is the largest. You should display the name of the peaks, that of the corresponding mountain ranges, and the distance itself.

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

Downloadable file: csucsok.txt.

(10 pont)

Deadline expired on June 10, 2016.


6 students sent a solution.
10 points:Kovács 246 Benedek, Nagy Ábel, Olexó Gergely, Rittgasszer Ákos.
9 points:Szakali Benedek.
6 points:1 student.

Problems in Information Technology of KöMaL, May 2016