In most physics problems dealing with simple trajectories, we assume that the acceleration due to gravity is constant. For most familiar situations this is a reasonable assumption, it does not hold true in all situations.
In reality, all objects attract all other objects with gravitational force. The strength of this attractive force increases as the masses of the objects increases, and also as the distance between the two object decreases. To calculate the exact force of gravity between two objects, we can use the following equation, known as Isaac Newton's Law of Universal Gravitation:
$$ \huge F_{g} = \frac{G M m}{r^{2}} $$
Where
F_g is the Force of Gravity pulling each object directly towards the other object, in Newtons.G is the Gravitational Constant, approximately 6.674e-11 N * m^2 / kg^2.m_1 is the Mass of the first object, in kg.m_2 is the Mass of the second object, in kg.r is the Distance between the two objects (specifically, the distance between their centers of mass), in meters.Two planets A and B exist in a faraway corner of outer space, such that that
the only forces acting upon them is the gravitational attractive force between each
other. The two planets have masses mA and mB, with radii rA and rB,
have their centers of mass in the exact center of each planet, and those centers are initially separated by
the distance r0. Initially at t = 0 both planets are not moving relative to each
other, immediately after which they will begin to move under the force of
gravitational attraction.
How many hours after t = 0 will it take before the two
planets collide?
Input Data
First line is Q, the quantity of testcases.
Q lines will then following, holding one testcase each in the format r0 rA rB mA mB.
Answer
Should consist of Q space-separated values, being how many hours
before the planets collide in each testcase.
Round each answer to the nearest integer.
Example
input data:
2
10 1 2 3 4
123456 12 34 56 78
answer:
264 141443309