This question, the title means that there are n balls from the height of the place of H, every second to drop a ball, ball and ball and the ball and the floor are directly elastic collision, the T-seconds after the position of each ball, that is, the height.
This problem, similar to ants, that is, the ball and the ball collision can be used as a non-conversion direction, continue to follow the original direction. That is, when r = 0, ignore the radius, calculate the position of each ball, each ball and the floor after the collision, will rise to the original height. The first time to calculate the drop requires t = sqrt (2 * h/g), each ball total time t, a total of complete return to k = t/t times.
K is odd and the final height is h-g * (k * t + t-t) ^ 2.
K is even and the final height is h-g * (t-k * T) ^ 2.
Figure out each ball, after sorting, is the final position of each ball, but the ball's R is 0.
Because R is greater than or equal to 1. So, finally add 2 * i * r/100.0 OK, I is the first ball, because R is the unit of centimeters, so divided by 100.0.
The following is the code for the AC:
#include <iostream> #include <cmath> #include <cstdio> #include <algorithm>using namespace std; int N, H, R, t;const double g = 10.0;double y[105];d ouble fun (int t) {if (T < 0) return h;double d;double temp = sqrt (2 * h/g); int k = int (t/temp), if (k% 2 = = 0) {d = t-temp * k;} else{d = k * temp + temp-t;} return h-g * d * D/2;} void Solve () {for (int i = 0; i < N; i++) {Y[i] = fun (t-i);} Sort (y, y + N); for (int j = 0; J < N; J + +) {j = = N-1 printf ("%.2lf\n", Y[j] + 2 * R * j/100.0): printf ("%.2lf", y [j] + 2 * R * j/100.0);}} int main () {int c;scanf ("%d", &c), while (c--) {scanf ("%d%d%d%d", &n, &h, &r, &t); solve ();} return 0;}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
PKU Acm3684--physics Experiment