UVA10387矩形内的无损碰撞

本文详细阐述了如何通过速度分解和应用勾股定理解决物理问题,包括利用速度的水平和垂直分量计算实际行走的距离。通过实例演示,使读者能够深入理解并掌握该方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

这题利用分速度来理解,由于是无损碰撞所以速度大小不变,由于每次碰撞与水平方向的角度都是一样,所以分解为垂直方向速度与水平

方向速度,速度均不变,由于最后会回到起点,所以可以利用勾股定理求出实际行走的距离,水平方向距离为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;
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值