这道题目的意思是,给你一个长为a宽为b的球桌,现在给它一个初速度,使得它在若干次碰撞后回到初始位置(题目里默认为小桌的中心)
现在告诉你小球和垂直边碰撞的次数m,以及和水平边碰撞的次数n,还有整个过程的时间s,让你求出碰撞的初速度以及出球的角度;
列方程求解:
b*n=v*sin(θ)*s
a*m=v*cos(θ)*s
所以得到
tan(θ)=(b*n)/(a*m);
可解出θ;
然后在代入原方程求解v即可;
#include<iostream>
#include<cmath>
using namespace std;

const double Pi=3.141592653;

int main ()


{

double a,b,s,m,n;
while(scanf("%lf%lf%lf%lf%lf",&a,&b,&s,&m,&n))

{
if(a==0&&b==b&&s==0&&m==0&&n==0)
break;
double degree;
double resultdegree;
degree=atan(b*n/(a*m));
resultdegree=atan(b*n/(a*m))/Pi*180;
double v;
v=(b*n)/(sin(degree)*s);
printf("%.2lf %.2lf\n",resultdegree,v);
}
system("pause");
return 0;
}