P3945 Three-Body Problem [std suspected to be incorrect]
Background
@FirstLight0521 The problem setter is here~
Because the Trisolarans’ star system is chaotic due to the unpredictability of three-body motion, Trisolarans live in constant turmoil. Kind human programmers (that is you, the great hero!) decide to help the Trisolarans, who are so foolish they cannot even write programs, by simulating the trajectories of celestial bodies. At this moment, the bored "Singer" civilization decides to tease you and adds some new celestial bodies to the Trisolaran system.
Description
You are given $N$ celestial bodies with their positions $(x_i, y_i, z_i)$ in space, initial velocities $(v_x, v_y, v_z)$, and masses $M_i$. It is known that, under the influence of the "Singer" civilization, time in the three-body world does not flow continuously (it updates every $0.01$ seconds). All celestial bodies are treated as point masses. Compute the positions of all celestial bodies at time $t$.
The universal gravitational constant $G$ is $6.67408 \times 10^{-11}$. In code, you may write:
```cpp
#define G 6.67408e-11
```
If your answer’s relative error does not exceed $0.5\%$ compared to the standard answer, you will receive AC on that test point. In other words, you may choose how many decimal places to keep. The standard answer keeps $12$ decimal places. This problem uses SPJ to check correctness.
Input Format
The first line contains a positive integer $N$ and a nonnegative real number $t$, representing the number of celestial bodies and the time, respectively.
The next $N$ lines each contain $7$ real numbers $x_i, y_i, z_i, M_i, v_x, v_y, v_z$, representing each body’s position, mass, and initial velocity (the velocity components in the three directions).
Output Format
Output $N$ lines. The $i$-th line contains the coordinates $x_i, y_i, z_i$ of the $i$-th body at time $t$, separated by single spaces.
Explanation/Hint
Constraints: $3 \le N \le 30$, $0 \le t \le 100$, $-100 \le x_i, y_i, z_i \le 100$. $M_i$ is within the range of long long.
Translated by ChatGPT 5