Dividing a field P83390


Statement
 

pdf   zip

thehtml

[r]

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.

Public test cases
  • Input

    2
    1 20
    10 6.420421
    

    Output

    1849.2414
    1000.0000
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Official solutions
    C++
    User solutions
    C++