这题利用分速度来理解,由于是无损碰撞所以速度大小不变,由于每次碰撞与水平方向的角度都是一样,所以分解为垂直方向速度与水平
方向速度,速度均不变,由于最后会回到起点,所以可以利用勾股定理求出实际行走的距离,水平方向距离为a*m,垂直距离方向为b*n;
然后由此求出距离,根据速度不变性原理和分解原理,速度初始角度即为行驶的水平距离和垂直距离的角度,利用atan即可求出然后注意转换成
角度。
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<set>
#include<cmath>
#include<cstring>
#include<cctype>
#include<climits>
#include<memory>
#include<climits>
#include<cstdlib>
using namespace std;
#define LL long long
#define INT (1LL<<62);
const double eps=1e-6;
const double pi=4*atan(1.0);
int dcmp(double x)
{
return fabs(x)<eps?0:(x>0?1:-1);
}
/*struct point
{
double x,y;
point() {};
point(double x,double y):x(x),y(y){};
point operator + (point b)
{
return point(x+b.x,y+b.y);
}
point operator - (point b)
{
return point(x-b.x,y-b.y);
}
point operator / (double b)
{
return point(x/b,y/b);
}
point operator * (double b)
{
return point(x*b,y*b);
}
void in()
{
cin>>x>>y;
}
};
double dot(point a,point b)
{
return a.x*b.x+a.y*b.y;
}
double length(point a)
{
return sqrt(dot(a,a));
}
double dd(point a,point b)
{
return sqrt((b.x-a.x)*(b.x-a.x)+(b.y-a.y)*(b.y-a.y));
}
point zx(point a)
{
double d=length(a);
return point(-a.y/d,a.x/d);
}*/
int main()
{
double a,b,s,m,n;
while(cin>>a>>b>>s>>m>>n&&(a||b||s||m||n))
{
double x=a*m;
double y=b*n;
printf("%.2f %.2f\n",atan(y/x)*180/pi,sqrt(x*x+y*y)/s);
}
return 0;
}