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

Problem S. 62. (April 2011)

S. 62. Some balls are dropped into a cylinder-shaped box. Your program s62 should determine the order in which their total height is minimal. (In the example, ``Magasság'' is height.)

The number of balls, the diameter of the cylinder and the radii of the balls are read from the input file. The result -- that is, the order of the balls and the minimal height -- is displayed on the screen to 6 digits precision. The name of the input file is a command line argument. In the example, ``Példa a bemenetre'' is a sample input, while ``Kimenet'' is the output.

The first line of the input contains the number of balls (\(\displaystyle 3\le n\le 30)\) and the diameter of the cylinder (\(\displaystyle 10\le d\le 100)\). The following \(\displaystyle n\) lines contain the radius of the balls (\(\displaystyle d/3<r<d/2)\).

The source code and project files of your solution -- without the .exe or any other auxiliary files generated by the compiler -- should be submitted together with a brief description of your solution (s62.txt, s62.pdf, ...) in a compressed file s62.zip. (This exercise is based on the exercise Project Euler #222.)

(10 pont)

Deadline expired on May 10, 2011.


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

Megoldásokról

Kevés megoldás érkezett, de a beküldöttek jól sikerültek.

A dobozba helyezett labdák méretére fontos feltétel, hogy sugaruk a doboz átmérőjének harmada és fele közé esnek. Ezért a labdák csak a közvetlenül alattuk levőre és a doboz falára támaszkodnak, másik labdával nem érintkeznek.

Két labda közös magassága a dobozban

és ebből a teljes magasság

Megoldás bemutatására Fekete János 12. osztályos hajdúböszörményi tanuló programját tesszük közzé: s62.pas

A teszteléshez használt adatállományok: labda.be1, labda.be2 és labda.be3.


Statistics:

5 students sent a solution.
10 points:Borsos 607 Zalán, Fekete 976 János, Mihálykó András, Nagy 111 Miklós.
9 points:Nagy Róbert.

Problems in Information Technology of KöMaL, April 2011