The Twin Paradox
Time limit1sMemory limit128 MB
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
where is the time experienced by B on the spaceship and is the time experienced by A on Earth. The conversion factor is defined as
where is the average speed of the spaceship and is the speed of light, both measured in the same units.
For example, if is 259,620,268 meters per second, then , so while 2 years pass for the twin on Earth, only 1 year passes for the twin on the spaceship.
Given and , 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 and separated by a space. It is always true that , and both values lie between and .
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 () and must be printed to three decimal places.