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

Zhang3 a participant of IPhO (Immortal Physics Olympiad). The 0th 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=t0 (s).

Help Zhang3 solve the problem!

The following information might help when solving the problem.

- Universal gravitation formula: F=Gm1m2/r2

- Gravitational constant: G=6.67430×1011m3/(kgs2)

Input

The first line of the input gives the number of test cases T(1T100). T test cases follow.

For each test case, the only line contains four integers a,b,d,t0(1a,b,d,t0100), 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 (t0+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 106.

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=t0=100,d=1,质点移动的距离远小于 106(所容许的误差值), 所以对于任意数据范围内的输入,都直接输出 d 即可。

哭了.

posted @   脂环  阅读(277)  评论(0编辑  收藏  举报
编辑推荐:
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!
点击右上角即可分享
微信分享提示
主题色彩