長方形桌面中心發射一球,已知長寬 a, b、運動時間 s、水平/垂直方向碰壁次數 m, n,求初速度與發射角度。
ta = a * m,垂直總位移 tb = b * ntc = sqrt(ta² + tb²)θ = atan(tb / ta),初速度 v = tc / s#include <cstdio>
#include <cmath>
using namespace std;
const double PI = atan(1.0) * 4.0;
int main() {
double a, b, s, m, n;
while (scanf("%lf%lf%lf%lf%lf", &a, &b, &s, &m, &n) == 5) {
if (a == 0 && b == 0 && s == 0 && m == 0 && n == 0) break;
double ta = a * m;
double tb = b * n;
double tc = sqrt(ta * ta + tb * tb);
printf("%.2lf %.2lf\n", atan(tb / ta) * 180 / PI, tc / s);
}
return 0;
}
rad * 180 / PI%.2lf