This page is still under construction.

Parts of this page are still being built. What you see may change.

The Twin Paradox

Time limit1sMemory limit128 MB

Summary
Given Earth time and spaceship time, compute the ship's average speed as a fraction of light speed and print it to three decimals.
Level

Easy2 of 10

Topics
Math, Implementation, Brute force, Simulation
Solved
No attempts yet

Problem

One of the most fascinating predictions of the special theory of relativity is that time passes more slowly for a moving object. The effect is so tiny that we normally never notice it, but it becomes appreciable when something moves at a speed close to the speed of light (299,792,458 meters per second).

This time dilation is often illustrated with the twin paradox. Twins A and B start out together; A stays on Earth while B boards a spaceship that travels at nearly the speed of light. After 50 years B returns to Earth, and A, now 50 years older, is shocked to find that B has aged only a few years.

The times experienced by the two twins are related by

tB=γ tAt_B = \gamma\, t_A

where tBt_B is the time experienced by B on the spaceship and tAt_A is the time experienced by A on Earth. The conversion factor γ\gamma is defined as

γ=1−v2c2\gamma = \sqrt{1 - \frac{v^2}{c^2}}

where vv is the average speed of the spaceship and cc is the speed of light, both measured in the same units.

For example, if vv is 259,620,268 meters per second, then γ≈0.5\gamma \approx 0.5, so while 2 years pass for the twin on Earth, only 1 year passes for the twin on the spaceship.

Given tAt_A and tBt_B, write a program that computes the average speed of the spaceship needed to produce this difference.

Input

The input consists of several test cases. Each test case is a single line containing two real numbers tAt_A and tBt_B separated by a space. It is always true that tA≥tBt_A \ge t_B, and both values lie between 1.01.0 and 100.0100.0.

The last line of the input contains two zeros; this line is not processed.

Output

For each test case, print the average speed of the spaceship on its own line. The speed is expressed in units of the speed of light (cc) and must be printed to three decimal places.

Examples1

  1. Example 1

    Input
    10.5 5.25
    5 1
    0 0
    
    Expected output
    0.866
    0.980