您的位置:首页 > 其它

hdu 2603 && 比赛 D - Wiskey's Power

2014-03-17 13:32 288 查看
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

Source

HDU 1st “Vegetable-Birds
Cup” Programming Open Contest

Recommend

lcy | We have carefully selected several similar problems for you: 2604 2606 2605 2607 2609

一开始看这道题目的时候就被吓到了,这是什么啊,这么多图,这么多字,不知道是什么意思,后来认真的看了一遍题目,发现自己有多水了,这道题其实就是高中时候的物理题目,只不过是用程序的语言写出来:
题意分为两种情况:
1),碰不到天花板:由于过程中只受重力的作用,没有阻力,所以,到达最高点的时候速度为0,从起点到达天花板和从天花板继续运动到0.5*h的时候速度不变都是vy,所以时间可以用:v末=vy-g*t=0,可得t1=2*(vy/g),后一段距离为3,初速度为vy,s=vy*t+(1/2)*g*t^2所以t2=(sqrt(vy*vy+2*g*3)-vy)/g,所以总时间为t=t1+t2;
2),碰到天花板:方法同上,不过要运用两次公式:t1=2*(vy-sqrt(vy*vy-2*g*0.5))/g,t2=(sqrt(vy*vy+2*g*3)-vy)/g,总时间为t=t1+t2;
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
const double pi=3.1415926;
const double g=9.87;

int main()
{
double v,m,a;
double t;
while(cin>>v>>m>>a)
{
double vx=cos(a*pi/180)*v;
double vy=sin(a*pi/180)*v;
if(vy*vy<=g)
t=2*vy/g+(sqrt(vy*vy+2*g*3)-vy)/g;
else
{
double t1=2*(vy-sqrt(vy*vy-2*g*0.5))/g;
double t2=(sqrt(vy*vy+2*g*3)-vy)/g;
t=t1+t2;
}
cout<<fixed<<setprecision(3)<<vx*t<<endl;
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐