hdu2603 Wiskey's Power(物理题)

Wiskey’s Power

Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 866 Accepted Submission(s): 402

Problem Description
Come back school from the 33rdACM / ICPC Asia ChenDu, everyone is exhausted, in particular the captain Wiskey. As saying that night, Wiskey drink a lot of wine, just as he blurred, fall to sleep. All of a sudden, Wiskey felt a slight discomfort in the chest, and then vomiting, vomitted all over. The next day, Wiskey is extremely sluggish, vomit still on the train.

Your task is to calculate the coordinates of vomit.
We assume that the quality of vomit is m, and its size can be ignored.
As the figure below:

The vomit start from the blue point A, whose speed is V, and its angle with X-axis is a. If the vomit hit the ceiling, then its value of the speed don’t changed and if before the collision the angle of the speed with X-axis is b, then after the collision the angle of the speed with X-axis is b , too.
Ignore air resistance, acceleration due to gravity g = 9.87m/s2, calculate and output Q.
(you can assume that the vomit will not fall to the higher berth)

Input
Each line will contain three numbers V , m and a (0 <= a < 90)described above.
Process to end of file.

Output
For each case, output Q in one line, accurate up to 3 decimal places.

Sample Input
100 100 45

Sample Output
3.992

Author
WhereIsHeroFrom

物理题,分析:
床位分为h1=0.5,h2=3两个部分
若碰到天花板:
1.在h1阶段分为上升阶段和下降阶段由于碰到天花板,上升阶段仅受到重力做功,由动能守恒推出末速度:1/2*m*v²=mgh1 —->v=sqrt(2gh),
即上升t1=2(Vy-sqrt(Vy²-2gh))/g
2.在h1下降阶段初速度为Vy,末速度2gh2,则推出–>t2=(sqrt(Vy²+2gh2)-vy)/g

若未碰到了天花板:
1.在h1阶段,由于未碰撞,上升至末速度为0时的运动守恒运动。直接计算上升和下降的则t1=2Vy/g
2.下降在h2开始,和上面碰到天花板一样运动,初速度为Vy,t2=(sqrt(Vy²+2gh2)-Vy)/g

由此计算出在h1时的运动时间t1,在h2时的运动时间t2,总时间为t1+t2,可计算出Vx=V*cos(θ)

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <cmath>
double const PI=3.1415926;
double const g=9.87;
using namespace std;
int main()
{
    double h1=0.5,h2=3;
    double v,m,a;
    double Q;
    while(cin>>v>>m>>a)
    {
        double vx=cos(a*PI/180)*v;
        double vy=sin(a*PI/180)*v;
        double t1,t2;
        if(vy*vy<2*g*h1)
        {
            t1=(2*vy)/g;
            t2=(sqrt(vy*vy+2*g*h2)-vy)/g;
        }
        else
        {
            t1=2*(vy-sqrt(vy*vy-2*g*h1))/g;
            t2=(sqrt(vy*vy+2*g*h2)-vy)/g;
        }
        printf("%.3f\n",vx*(t1+t2));
    }
    return 0;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值