Dividing a field

[image]

When Jordi and Mireia married several years ago, they put their gold
together to buy a circular field with a radius of 1000 meters. Jordi put
J kg of gold, and Mireia put M kg. Time has passed and they divorce, so
they have decided to divide the field in such a way that each one
receives an area proportional to the gold invested by he or she. They
will use a rope of length L meters, tie one extreme to the easternmost
point, and use the other extreme to mark the limit of the fields. Since
Jordi is a gentleman, he will settle for the left, worst shaped field,
while Mireia will get the field to the right, painted green in the
picture.

The problem you must solve is: given the amounts of gold J and M, which
must be the length L of the rope?

Input

Input begins with the number of cases. Every case consists of two real
numbers J ∈ [1, 100] and M ∈ [1, 100].

Output

For every case, print the length L of the rope with four digits after
the decimal point. The input cases have no precision issues.

Problem information

Author: Salvador Roura

Generation: 2026-01-25T11:59:49.322Z

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