Apollonian Gasket

Quido is fond of Apollonian gaskets. They are planar fractals generated from triples of circles, where each circle is tangent to the other two. In his drawing of the gasket, Quido starts with two externally tangent circles which diameter is D1 and D2. Then he adds a third circle which diameter is D1+D2 and to which the two original circles are internally tangent. This is the first generation of circles.

Each subsequent generation of circles is constructed by applying the following scheme:

For any three circles A, B C of any previous generations which are tangent to each other a new circle is constructed which is tangent to A,B,C. The new circle must differ from all circles constructed so far. When a generation is complete, i.e no other circle can be added, then the next generation of circles can start being constructed.

                 The leftmost scheme shows the first generation, each next scheme contains one more generation of circles.

There is an additional stopping rule which prevents Quido from generating infinitesimally small circles. A circle can be added to the gasket if and only if the lenght of its diameter is least minD which is a fixed positive value.

The task

Given the values D1, D2 and minD find the sum of areas and also the sum of perimeters of all circles in the gasket excluding the largest one.


Input consists of one line with three decimal numbers D1, D2 and minD. The number are separated by spaces. The format is usual decimal format (see also the examples bellow) with no exponent part. 

It holds that 1.0 ≤ D1, D2 ≤ 1000.0,     0.001 ≤ minD ≤ D1+D2.


Ouput consists of one text line containing two decimal numbers L1 and L2. L1 represents the sum of areas of all circles in the gasket except for the bigggest circle. L2 represents the sum of perimeters of all circles in tin the gasket except for the bigggest circle. Both output values are rounded to 3 decimal digits. Decimal digits must be always present in the output even if some of them are zeros.

Maximim output value is less than 107.


Example 1


17.000000 40.000000 1.000000


2439.259 835.263  

Example 2


10.000000 10.000000 2.000000


261.799 146.608  


Example 3


2.000000 50.000000 1.000000


2066.462 408.747  

Example 4


1000.022000 811.047000 0.025000


2575261.696 292760.964

P.S Code should be written with the help of 2D or 3D or moreD matrices without using Numpy Read Less

Compétences : Python

en voir plus : tin tin vector, read hipaa 835 vbnet, tin tin vector graphics, apollonian gasket generator, apollonian gasket lesson, apollonian gasket interactive, descartes theorem, fractal, apollonian circles, apollonian gasket javascript, apollonian gasket gif, kraft foods philippines tin, royal tin web design, cartoon drawing tin man wizard, ansi 835 net object, draw cartoon tin man, tin man cartoon character, tin phone tight string loose string, tin calamba, tin tin illustrator

Concernant l'employeur :
( 0 commentaires ) Prague, Czech Republic

Nº du projet : #19951931

3 freelance font une offre moyenne de $23 pour ce travail


***** Dear Client! ***** Thank you for your attention I am a Good Programmer with 7 years of experience in full circle of software development. Specially interested in Python and R Coding,Web Scraping,Data An Plus

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% USD en 1 jour
(19 Commentaires)

I am a Python expert. I have worked in Python development for 7+ years. And then I am a good english speaker. So anytime,anywhere you will discuss anything with me freely. Credit is the most important to me. No credit, Plus

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 7 jours
(12 Commentaires)

Hi. I am a python programming expert. And I mastered in almost algorithm. I've got many experience in solving problems concerned with algorithm using python language. I am very interesting and I hope I'd like to wo Plus

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% USD en 1 jour
(0 Commentaires)