码迷,mamicode.com
首页 > 其他好文 > 详细

HDU6812 Kindergarten Physics(假物理题真思维)

时间:2020-07-30 22:15:00      阅读:110      评论:0      收藏:0      [点我收藏+]

标签:mos   思维   put   HERE   you   差值   case   work   with   

Zhang3 a participant of IPhO (Immortal Physics Olympiad). The \(0^\mathrm{th}\) problem in the contest is as follows.

There are two balls that weigh \(a\) kg and \(b\) kg respectively. They can be regarded as particles in this problem, as they are small enough. At the very beginning (i.e. \(t = 0\)), the distance between two balls is \(d\) km, and both of them are not moving.

Assuming that only gravitation works in this system (no other objects or other forces considered). The two balls has started moving since \(t = 0\). Your task is to calculate the distance between them when \(t = t_0\) (s).

Help Zhang3 solve the problem!

The following information might help when solving the problem.

- Universal gravitation formula: \(F = G \cdot m_1 \cdot m_2 / r ^ 2\)

- Gravitational constant: \(G = 6.67430 \times 10^{-11} \; \mathrm{m}^3 / (\mathrm{kg} \cdot \mathrm{s}^2)\)

Input

The first line of the input gives the number of test cases \(T \; (1 \le T \le 100)\). \(T\) test cases follow.

For each test case, the only line contains four integers \(a, b, d, t_0 \; (1 \le a, b, d, t_0 \le 100)\), representing the mass of the two balls, the initial distance between them, and how much time the balls move.

It is guaranteed that two balls will not collide within \((t_0 + 1)\) seconds.

Output

For each test case, print a line with a real number \(x\), representing that the distance is \(x\) km.

Your answers should have absolute or relative errors of at most \(10^{-6}\).

Sample Input

3
1 2 3 4
7 73 7 68
100 100 1 100

Sample Output

2.99999999999999999982
6.99999999999999974807
0.99999999999993325700

显然,两个质点移动的距离与质量、时间正相关,与距离负相关。自己估算或者观察样例,发现在 数据范围可能的最坏情况下 \(a=b=t_0=100,d=1\),质点移动的距离远小于 \(10^{-6}\)(所容许的误差值), 所以对于任意数据范围内的输入,都直接输出 d 即可。

哭了.

HDU6812 Kindergarten Physics(假物理题真思维)

标签:mos   思维   put   HERE   you   差值   case   work   with   

原文地址:https://www.cnblogs.com/lipoicyclic/p/13406063.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!