Limits 2s, 512 MB

One day the author imagined an analog clock with minute and hour arms. The thought was simple: if we consider the two arms as two sides of a triangle and join the separate ends of the arms for the third side of the triangle, then at different times throughout the day and night, the area of the triangle varies. A natural question then arises, given the lengths of minute and hour arms, what is the maximum area of the triangle?

In this picture, the blue line segments represent minute and hour arms, and the red line segment represents the third side of the triangle.


The first line of the input represents the number of test cases T(0<T<500001)T ( 0 < T < 500001). The following TT lines each contain two floating point numbers aa and b(0<a,b108)b (0 < a, b \leq 10^8) representing the length of the hour and the minute arms, respectively.


For each case, print the maximum area that can be achieved at some position of the hour and minute arms as described above. Errors less than 10610^{-6} will be ignored.


661.5611881304 354.5250382063


Login to submit.


90% Solution Ratio
Asif_AlimEarliest, Jan '23
JanLitwinFastest, 0.3s
Saeed_adnanLightest, 3.0 MB
Nusab19Shortest, 60B
Toph uses cookies. By continuing you agree to our Cookie Policy.