El campanar de la Torrassa is 75 years old!

ifnextchar ( ifnextchar (offsettrue(0pt,0pt) offsetfalse ifnextchar
[(0pt,0pt)(0pt,0pt) ifnextchar
[(0pt,0pt)(0pt,0pt)[l](0pt,0pt)(0pt,0pt)[l][] [r][image] El Campanar de
la Torrassa is the mythical bell tower of a church in the district of La
Torrassa in the city of L’Hospitalet de Llobregat. This tower (which
celebrates its 75th birthday precisely this year!) is near the author’s
home, where some nice (but not wild!) parties with the UPC contestants
took place. During one of those parties, Masao heard the sound of the
bells, and immediately his powerful brain started to wander and wonder:
“Let’s suppose that a clock has an hour hand 3 units long, a minute hand
4 units long, and a second hand 5 units long. The hour hand moves once
every hour, the minute hand moves once every minute, and the second hand
moves once every second. Therefore, exactly every second, the triangle
defined by the ends of the hands changes its area.
For instance, to the right you can see the positions of the hands at
00:15:25. Note that the hour hand is vertical and the minute hand is
horizontal.

ifnextchar ( ifnextchar (offsettrue(0pt,0pt) offsetfalse ifnextchar
[(0pt,0pt)(0pt,0pt) ifnextchar
[(0pt,0pt)(0pt,0pt)[l](0pt,0pt)(0pt,0pt)[l][] [r][image]

Which is the maximum area between two given times?”

Input

Input consists of several cases, each with h₁ : m₁ : s₁ and
h₂ : m₂ : s₂. You can assume 0 ≤ h₁ < 12, 0 ≤ m₁ < 60, 0 ≤ s₁ < 60, as
well as 0 ≤ h₂ < 12, 0 ≤ m₂ < 60, 0 ≤ s₂ < 60. The time h₁ : m₁ : s₁ is
strictly smaller than h₂ : m₂ : s₂.

Output

For every case, print with three digits after the decimal point the
largest area from h₁ : m₁ : s₁ to h₂ : m₂ : s₂, both times included.
This problem has no precision issues, as long as you take special care
of times like 01:05:35.

Hint

Remember that the area of a triangle with sides of length a, b and c is
$\sqrt{s(s-a)(s-b)(s-c)\,}$, where s = (a + b + c)/2 is the
semiperimeter of the triangle.

Problem information

Author: Jordi Petit

Generation: 2026-01-25T10:18:57.702Z

© Jutge.org, 2006–2026.
https://jutge.org
