Wiskey's Power
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 566 Accepted Submission(s): 262
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)

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.
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
题意:一个人在3米高的卧铺沿着一个角度呕吐,在他上方0.5米处有天花板,这里他呕吐的东西碰到天花板不会使速度的大小和质量减少而且只改变了速度方向,若按原方向会与天花板成夹角b向上,那么撞到天花板后会与天花板成夹角b 但方向向下。现让你求出呕吐的东西落地的距离,现让人呕吐的竖直地方为0且呕吐的东西不会落到其床铺。
物理题:注意判断当前速度能不能到达天花板。
#include <cstdio>
#include <cstring>
#include <cmath>
#define g 9.87
#define PI 3.1415926
using namespace std;
double v, m, a;
void solve()
{
double horv = v * cos(a * PI / 180);
double vecv = v * sin(a * PI / 180);
double v1;//记录过线反射后的速度
double v2;//记录最终落地的速度
double h;//最终下降的高度
double t = vecv / g;//计算当前竖直速度能持续的时间
if(g*t*t/2 >= 0.5)//能过线
{
v1 = sqrt(vecv * vecv - 2 * g *0.5);
h = 3.5;
}
else//没到线就开始下降了
{
v1 = 0;
h = vecv * vecv / 2 / g + 3;
}
t = 0;//初始化
t += (vecv - v1) / g;
v2 = sqrt(v1 * v1 + 2 * g * h);
t += (v2 - v1) / g;
printf("%.3lf\n", horv*t);
}
int main()
{
while(scanf("%lf%lf%lf", &v, &m, &a) != EOF)
{
solve();
}
return 0;
}