hdu 2603 Wiskey's Power(数学题),待改正

1、http://acm.hdu.edu.cn/showproblem.php?pid=2603

2、题目大意

一个物品重m,从3米处上抛,知道上抛的角度,3.5米处有隔板,撞到隔板后以相同角度往下走,求最终落地的坐标

3、这是一道解物理方程的题目,但是不知道哪里错了

题目:

Wiskey's Power

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


Problem Description
Come back school from the 33 rdACM / 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/s 2, 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
 

Source
 

Recommend
lcy   |   We have carefully selected several similar problems for you:   2600  2604  2606  2605  2607
4、AC代码:
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<string.h>
int main()
{
    double m,v,a;
    double vx1,vy1,h1=0.5,h2=3.5,vx,vy,vz,t1,t2,g=9.87,x1,x2;
    while(scanf("%lf%lf%lf",&m,&v,&a)!=EOF)
    {
        vx1=v*cos(a*3.1415926/180);
        vy1=v*sin(a*3.1415926/180);
        if(vy1*vy1/(2*g)<=h1)
        {
            t1=vy1/g;
            t2=sqrt(2*h2/g);
            printf("%.3f\n",vx1*(t1+t2));
        }
        else
        {
            t1=(vy1-sqrt(vy1*vy1-2*g*h1))/g;
            vx=vx1;
            vy=vy1-g*t1;
            x1=vx*t1;
            t2=(-vy+sqrt(vy*vy+2*g*h2))/g;
            x2=vx*t2;
            printf("%.3f\n",x1+x2);
        }
    }
    return 0;
}
/*
100 200 50
200 10 35
*/



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值