Wiskey's Power
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 341 Accepted Submission(s): 156
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)
![](http://acm.hdu.edu.cn/data/images/C154-1004-1.jpg)
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:
![](http://acm.hdu.edu.cn/data/images/C154-1004-2.jpg)
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.
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
计算出S=忽略天花板能到达的距离;然后列方程,计
算出轨道抛物线和天花板是否有交点,有两个交点的话,
S-=两个交点的距离。输出S即可。
#include"stdio.h"
#include"string.h"
#include"math.h"
#define g 9.87
int main()
{
double v,m,ang;
double v_c,v_s;
double a,b,c,dir;
double ans;
while(scanf("%lf%lf%lf",&v,&m,&ang)!=-1)
{
ang=ang*3.1415927/180;
v_s=v*cos(ang);
v_c=v*sin(ang);
ans=v_s*(v_c/g+sqrt(2*(3+0.5*v_c*v_c/g)/g));
a=g/2/v_s/v_s;
b=-(v_c/v_s);
c=0.5;
dir=b*b-4*a*c;
if(dir<0) printf("%0.3lf\n",ans);
else printf("%0.3lf\n",ans-sqrt(dir)/a);
}
return 0;
}
转载自http://blog.csdn.net/ice_crazy/article/details/8037778